# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1017924 | Almonther | September (APIO24_september) | C++17 | 1022 ms | 1224 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define co cout<<
//#pragma GCC optimize("O3,Ofast,unroll-loops")
//#pragma GCC target("avx2,sse3,sse4,avx")
using namespace std;
//stuff
bool isvalid(vector<int>tre,vector<int>del){
bool vis[tre.size()+5]={};
bool canottake[tre.size()+5]={};
for(auto i:del) canottake[i]=1;
vector<int>v[tre.size()+5];
for(int i=0;i<tre.size();i++){
if(tre[i]==-1) continue;
v[tre[i]].push_back(i);
}
queue<int>proces;
proces.push(0);
while(proces.size()){
int num=proces.front();
proces.pop();
vis[num]=1;
if(canottake[num]) continue;
for(auto i:v[num]){
proces.push(i);
}
}
for(int i=0;i<tre.size();i++){
if(vis[i]==0&&canottake[i]==0) return 0;
}
return 1;
}
int solve(int N,int M,vector<int>F,vector<vector<int>>S){
int ans=0;
for(int i=1;i<N;i++){
bool isgood=1;
for(int j=0;j<M;j++){
vector<int>curr;
for(int k=0;k<i;k++){
curr.push_back(S[j][k]);
}
if(!isvalid(F,curr)) isgood=0;
}
ans+=isgood;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |