제출 #374445

#제출 시각아이디문제언어결과실행 시간메모리
374445Aryan_Raina곤돌라 (IOI14_gondola)C++14
25 / 100
39 ms4736 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, int a[]) { int rr = -1; set<int> vis; for (int i = 0; i < n; i++) { if (vis.count(a[i])) return 0; vis.insert(a[i]); if (a[i] <= n) { if (rr == -1) rr = i; if ((n + a[i] - a[rr]) % n != (n + i - rr) % n) return 0; } } return 1; } //---------------------- int replacement(int n, int a[], int replacementSeq[]) { int rr = -1; for (int i = 0; i < n; i++) { if (a[i] <= n) { rr = i; break; } } vector<array<int,2>> rep; for (int i = 0; i < n; i++) { if (a[i] > n) { int x = (a[rr] + i - rr + n) % n; if (x == 0) x = n; rep.push_back({a[i], x}); } } sort(rep.begin(), rep.end()); int ind = 0, last = n+1; for (int i = 0; i < rep.size(); ++i) { for (; last <= rep[i][0]; ++last) replacementSeq[ind++] = rep[i][1]; } return ind; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

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

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:39:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for (int i = 0; i < rep.size(); ++i) {
      |                  ~~^~~~~~~~~~~~
#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...