제출 #1354493

#제출 시각아이디문제언어결과실행 시간메모리
1354493branches1029Guessing Game (EGOI23_guessinggame)C++20
30 / 100
372 ms864 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int o, n;
int cnt1, cnt2;
int used[50005];

void Anna(){
    cout << 50000 << endl;
    for( int i=1 ; i<n ; i++ ){
        int x;
        cin >> x;
        if( x<50000 ){
            cnt1++;
            cout << cnt1 << endl;
        }
        else{
            cnt2++;
            cout << cnt2 << endl;
        }
    }
}

void Bertil(){
    int ans1=-1, ans2=-1;
    int mx1, mx2;
    for( int k=0 ; k<2 ; k++ ){
        for( int i=1 ; i<=50000 ; i++ ) used[i]=-1;
        for( int i=0 ; i<50000 ; i++ ){
            int a;
            cin >> a;
            if( used[a]==-1 ) used[a]=i+k*50000;
            else{
                ans1=used[a];
                ans2=i+k*50000;
            }
            if( a==50000 ){
                if( k==0 ) mx1=i;
                else mx2=i+50000;
            }
        }
    }
    if( ans1!=-1 ) cout << ans1 << ' ' << ans2 << endl;
    else cout << mx1 << ' ' << mx2 << endl;
}

int main(){

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> o >> n;
    if( o==1 ) Anna();
    else Bertil();

    return 0;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…