제출 #1000116

#제출 시각아이디문제언어결과실행 시간메모리
1000116Andrey9월 (APIO24_september)C++17
100 / 100
106 ms14728 KiB
#include "september.h" #include<bits/stdc++.h> using namespace std; vector<int> haha[200001]; int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S) { int n = N,m = M; for(int i = 0; i <= n; i++) { haha[i].clear(); } for(int i = 1; i < n; i++) { haha[F[i]].push_back(i); } vector<int> p(n+1); for(int i = 0; i < n-1; i++) { for(int j = 0; j < m; j++) { p[S[j][i]] = max(p[S[j][i]],i); } } int y = 0,ans = 0; for(int i = 0; i < n-1; i++) { for(int j = 0; j < m; j++) { int a = S[j][i]; y = max(y,p[a]); for(int v: haha[a]) { y = max(y,p[v]); } } if(y <= i) { ans++; } } return ans; }
#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...