제출 #373465

#제출 시각아이디문제언어결과실행 시간메모리
373465idk321곤돌라 (IOI14_gondola)C++11
25 / 100
127 ms1644 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; const int M = 250005; int valid(int n, int seq[]) { vector<int> vis(M); for (int i = 0; i < n; i++) vis[seq[i]] = true; bool imp = false; for (int i = n; i < M; i++) { if (!vis[i]) { imp = 1; } else { if (imp) return 0; } } int cur = -1; for (int i = 0; i < n; i++) seq[i]--; for (int i = 0; i < n; i++) { if (seq[i] < n) { cur = i; break; } } if (cur == -1) return 1; int val = seq[cur]; for (int i = cur + 1; i < n; i++) { val++; val %= n; if (seq[i] < n && seq[i] != val) return 0; } return 1; } //---------------------- int replacement(int n, int seq[], int seq2[]) { vector<int> to(M, -1); int biggest = -1; int cbig = -1; for (int i = 0; i < n; i++) { seq[i]--; to[seq[i]] = i; if (seq[i] > cbig) { cbig = seq[i]; biggest = i; } } if (cbig == n - 1) return 0; int org[M]; for (int i = 0; i < n; i++) org[i] == -1; for (int i = 0; i < n; i++) { if (seq[i] < n) { for (int j = 0; j < n; j++) { org[j] = ((seq[i] - (i - j)) % n + n) % n; } break; } } if (org[0] == -1) { for (int i = 0; i < n; i++) org[i] = i; } int cur = 0; for (int cnum = n; cnum <= cbig; cnum++) { if (to[cnum] == -1) { seq2[cur] = org[biggest] + 1; org[biggest] = cnum; } else { seq2[cur] = org[to[cnum]] + 1; org[to[cnum]] = cnum; } cur++; } return cur++; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

컴파일 시 표준 에러 (stderr) 메시지

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:74:40: warning: statement has no effect [-Wunused-value]
   74 |     for (int i = 0; i < n; i++) org[i] == -1;
      |                                 ~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...