Submission #776052

#TimeUsernameProblemLanguageResultExecution timeMemory
776052SharkySequence (APIO23_sequence)C++17
0 / 100
134 ms31508 KiB
#include "sequence.h" #include <bits/stdc++.h> using namespace std; #define DEBUG if (1) int sequence(int N, std::vector<int> A) { vector<int> pos[N + 1]; for (int i = 0; i < N; i++) pos[A[i]].push_back(i); for (int i = 1; i <= N; i++) { if ((int) pos[i].size() <= 1) continue; if (pos[i][1] - pos[i][0] == 1) return 2; } for (int i = 1; i <= N; i++) { if ((int) pos[i].size() <= 1) continue;\ int dl = pos[i][0] - 1; int dr = N - pos[i][1]; int d = pos[i][1] - pos[i][0]; if ((dl + 1) >= d) return 2; if ((dr + 1) >= d) return 2; } return 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...