# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1173009 | Robert_junior | September (APIO24_september) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(), x.end()
#define ins insert
#define pb push_back
#define F first
#define S second
const int N = 2e5 + 7, M = 5e5 + 7, k = 640;
const int mod = 1e9 + 7;
int cnt[N];
int solve(int N, int M, vector<int> F, vector<vector<int>> S){
for(int i = 0; i < N; i++){
cnt[i] = 0;
}
int cur = 0;
int ans = 0;
int j = 0;
while(j < N - 1){
for(int i = 0; i < M; i++){
cnt[S[i][j]]++;
if(cnt[S[i][j]] == M) cur++;
}
if(cur == j + 1) ans++;
j++;
}
return ans;
}