Submission #481417

#TimeUsernameProblemLanguageResultExecution timeMemory
481417rainboyPolitičari (COCI20_politicari)C11
70 / 70
25 ms2216 KiB
#include <stdio.h> #define N 500 int main() { static int kk[N][N], tt[N][N]; int n, i, j, k, t; long long t_; scanf("%d%lld", &n, &t_); if (t_ <= 2) { printf("%lld\n", t_); return 0; } for (i = 0; i < n; i++) for (j = 0; j < n; j++) scanf("%d", &kk[i][j]), kk[i][j]--; for (i = 0; i < n; i++) for (j = 0; j < n; j++) tt[i][j] = -1; i = 0, j = 1, t = 1; while (t < t_ && tt[i][j] == -1) { tt[i][j] = t; k = kk[j][i], i = j, j = k, t++; } if (t != t_) { t_ = (t_ - t) % (t - tt[i][j]), t = 0; while (t < t_) k = kk[j][i], i = j, j = k, t++; } printf("%d\n", i + 1); return 0; }

Compilation message (stderr)

politicari.c: In function 'main':
politicari.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%lld", &n, &t_);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
politicari.c:17:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |    scanf("%d", &kk[i][j]), kk[i][j]--;
      |    ^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...