Submission #1915081


Source Code Expand

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;
    int most_far = 1;
    int most_far_distance = 0;
    for(int i = 2; i <= N; i++){
        cout << "? " << 1 << " " << i << endl;
        int distance;
        cin >> distance;
        if(most_far_distance < distance){
            most_far = i;
            most_far_distance = distance;
        }
    }
    int ans = 0;
    for(int i = 1; i <= N; i++){
        if(most_far != i){
            cout << "? " << most_far << " " << i << endl;
            int distance;
            cin >> distance;
            ans = max(ans, distance);
        }
    }
    cout << "! " << ans << endl;
}

Submission Info

Submission Time
Task D - 高橋くんと木の直径
User June_boy
Language C++14 (GCC 5.4.1)
Score 100
Code Size 714 Byte
Status AC
Exec Time 7 ms
Memory 724 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 20 / 20 80 / 80
Status
AC × 1
AC × 22
AC × 42
Set Name Test Cases
Sample subtask0_0.txt
Subtask1 subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_2.txt, subtask1_20.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt, subtask0_0.txt
All subtask0_0.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_2.txt, subtask1_20.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt, subtask2_0.txt, subtask2_1.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt, subtask2_16.txt, subtask2_17.txt, subtask2_18.txt, subtask2_19.txt, subtask2_2.txt, subtask2_3.txt, subtask2_4.txt, subtask2_5.txt, subtask2_6.txt, subtask2_7.txt, subtask2_8.txt, subtask2_9.txt
Case Name Status Exec Time Memory
subtask0_0.txt AC 4 ms 724 KB
subtask1_0.txt AC 6 ms 716 KB
subtask1_1.txt AC 6 ms 720 KB
subtask1_10.txt AC 6 ms 724 KB
subtask1_11.txt AC 6 ms 724 KB
subtask1_12.txt AC 6 ms 720 KB
subtask1_13.txt AC 6 ms 720 KB
subtask1_14.txt AC 6 ms 724 KB
subtask1_15.txt AC 6 ms 720 KB
subtask1_16.txt AC 6 ms 724 KB
subtask1_17.txt AC 7 ms 716 KB
subtask1_18.txt AC 6 ms 716 KB
subtask1_19.txt AC 6 ms 720 KB
subtask1_2.txt AC 6 ms 720 KB
subtask1_20.txt AC 3 ms 592 KB
subtask1_3.txt AC 6 ms 720 KB
subtask1_4.txt AC 6 ms 716 KB
subtask1_5.txt AC 6 ms 720 KB
subtask1_6.txt AC 6 ms 716 KB
subtask1_7.txt AC 6 ms 724 KB
subtask1_8.txt AC 6 ms 720 KB
subtask1_9.txt AC 6 ms 720 KB
subtask2_0.txt AC 6 ms 724 KB
subtask2_1.txt AC 7 ms 720 KB
subtask2_10.txt AC 6 ms 720 KB
subtask2_11.txt AC 6 ms 720 KB
subtask2_12.txt AC 6 ms 724 KB
subtask2_13.txt AC 6 ms 724 KB
subtask2_14.txt AC 7 ms 720 KB
subtask2_15.txt AC 6 ms 720 KB
subtask2_16.txt AC 6 ms 720 KB
subtask2_17.txt AC 6 ms 720 KB
subtask2_18.txt AC 6 ms 720 KB
subtask2_19.txt AC 6 ms 724 KB
subtask2_2.txt AC 6 ms 724 KB
subtask2_3.txt AC 6 ms 724 KB
subtask2_4.txt AC 6 ms 720 KB
subtask2_5.txt AC 6 ms 724 KB
subtask2_6.txt AC 6 ms 720 KB
subtask2_7.txt AC 6 ms 720 KB
subtask2_8.txt AC 6 ms 720 KB
subtask2_9.txt AC 7 ms 720 KB