Submission #1061689

#TimeUsernameProblemLanguageResultExecution timeMemory
1061689rainboySeptember (APIO24_september)C++17
0 / 100
1 ms716 KiB
#include "september.h" #include <cstring> #include <vector> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; const int N = 100000; int gg[N], dd[N]; int solve(int n, int m, vi pp, vector<vi> iii) { for (int g = 0; g < n - 1; g++) gg[iii[0][g]] = g; gg[0] = n - 1; memset(dd, 0, n * sizeof *dd); for (int h = 1; h < m; h++) for (int g = 0; g < n - 1; g++) { int g_ = gg[iii[h][g]]; if (g < g_) dd[g]++, dd[g_]--; else dd[g_]++, dd[g]--; } for (int j = 1; j < n - 1; j++) { int i = pp[j]; if (gg[i] < gg[j]) dd[gg[i]]++, dd[gg[j]]--; } for (int g = 1; g < n; g++) dd[g] += dd[g - 1]; int cnt = 0; for (int g = 0; g < n - 1; g++) if (dd[g] == 0) cnt++; return cnt; }
#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...