Submission #341063

#TimeUsernameProblemLanguageResultExecution timeMemory
341063mohamedsobhi777곤돌라 (IOI14_gondola)C++14
10 / 100
17 ms1260 KiB
#include <bits/stdc++.h> using namespace std; #define f first #define s second #include "gondola.h" int valid(int n, int inputSeq[]) { map<int, int> mp; int Max = 0; if (*min_element(inputSeq, inputSeq + n) > n) return 1; for (int i = 0; i < n; ++i) inputSeq[i]--; auto check1 = [&](int i) -> bool { bool ret1 = 1, ret2 = 1; for (int j = 1; j < n; ++j) { int nxt = (i + j) % n; if (inputSeq[nxt] >= n) continue; if (inputSeq[nxt] != (inputSeq[i] + j) % n) ret1 = 0; if (inputSeq[nxt] != (inputSeq[i] - j + n) % n) ret2 = 0; } return ret1 | ret2; }; auto check2 = [&](int i) -> bool { bool ret1 = 1, ret2 = 1; for (int j = 1; j < n; ++j) { int nxt = (i - j + n) % n; if (inputSeq[nxt] >= n) continue; if (inputSeq[nxt] != (inputSeq[i] + j) % n) ret1 = 0; if (inputSeq[nxt] != (inputSeq[i] - j + n) % n) ret2 = 0; } return ret1 | ret2; }; for (int i = 0; i < n; ++i) { if (inputSeq[i] < n) return check1(i) | check2(i); } } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:11:12: warning: unused variable 'Max' [-Wunused-variable]
   11 |        int Max = 0;
      |            ^~~
gondola.cpp:10:22: warning: control reaches end of non-void function [-Wreturn-type]
   10 |        map<int, int> mp;
      |                      ^~
#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...