답안 #526513

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526513 2022-02-15T05:56:57 Z brayden04 Političari (COCI20_politicari) C++14
35 / 70
1000 ms 3232 KB
#include <bits/stdc++.h>
#define endl '\n'
#define int long long

using namespace std;

vector<int> adjlst[505];

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int N, K;
    cin >> N >> K;

    for (int i = 1; i <= N; i++){
        for (int i2 = 1; i2 <= N; i2++){
            int temp = 0;
            cin >> temp;
            adjlst[i].push_back(temp);
        }
    }

    int curPerson = 1;
    int prevShow = 0;

    for (int i = 1; i <= K - 1; i++){
        if (prevShow == 0){
            curPerson += 1;
            prevShow = 1;
        }
        else{
            int tempPrev = prevShow;
            prevShow = curPerson;
            curPerson = adjlst[curPerson][tempPrev-1];
        }
    }

    cout << curPerson << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 1079 ms 844 KB Time limit exceeded
3 Execution timed out 1026 ms 2360 KB Time limit exceeded
4 Execution timed out 1056 ms 2756 KB Time limit exceeded
5 Execution timed out 1028 ms 3136 KB Time limit exceeded
6 Execution timed out 1067 ms 3232 KB Time limit exceeded
7 Correct 1 ms 308 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 7 ms 972 KB Output is correct
10 Correct 15 ms 2796 KB Output is correct
11 Correct 17 ms 3148 KB Output is correct
12 Correct 17 ms 3144 KB Output is correct
13 Execution timed out 1081 ms 332 KB Time limit exceeded
14 Execution timed out 1082 ms 596 KB Time limit exceeded