답안 #732255

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
732255 2023-04-28T20:29:16 Z vjudge1 Političari (COCI20_politicari) C++17
컴파일 오류
0 ms 0 KB
// author: MisterReaper (Ahmet Alp Orakci)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int) x.size()

#ifndef ONLINE_JUDGE
    #include "debug.h"
    #define OPEN freopen(".in", "r", stdin); freopen(".out", "w", stdout);
    #define TIME cerr << "\n" << fixed << setprecision(2) << 1000.0 * clock() / CLOCKS_PER_SEC << " milliseconds ";
#else
    #define debug(...) void(23)
    #define OPEN void(0000)
    #define TIME void(232323233)
#endif

void solve()
{
    int n, k; cin >> n >> k;
    int arr[n +1][n +1], vis[n +1][n +1];
    memset(vis, -1, sizeof(vis));

    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            cin >> arr[j][i];
        }
    }

    vector <int> v;
    v.emplace_back(1);
    v.emplace_back(2);

    while(true)
    {
        if(vis[v[sz(v) - 2]][v.back()] != -1) break;
        vis[v[sz(v) - 2]][v.back()] = sz(v) -2;

        v.emplace_back(arr[v[sz(v) - 2]][v.back()]);
    }

    debug(v);

    if(k < sz(v))
    {
        cout << v[k -1];
        return;
    }

    k -= vis[v[sz(v) -2]][v.back()];

    vector <int> ans;
    for(int i = vis[v[sz(v) -2]][v.back()]; i < sz(v) -2; i++) ans.emplace_back(v[i]);

    debug(ans);

    k %= sz(ans);
    cout << ans[(k -1 + sz(ans)) % sz(ans)];
    
    return;
}

int32_t main()
{
    OPEN;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t = 1; //cin >> t;
    while(t--)
    {
        solve();
    }

    TIME;

    return 0;
}

Compilation message

politicari.cpp:8:14: fatal error: debug.h: No such file or directory
    8 |     #include "debug.h"
      |              ^~~~~~~~~
compilation terminated.