제출 #1143186

#제출 시각아이디문제언어결과실행 시간메모리
1143186victor_c새로운 문제 (POI13_ins)C++20
0 / 100
2 ms1352 KiB
#include <iostream> using namespace std; bool mat[1005][1005], ok[1005]; int cnt[1005], num[1005]; int main() { int z, n, m, t, p, alt, c=0; cin>>z; for(int i=1; i<=z; i++) { for(int j=0; j<1005; j++) { ok[j]=0; cnt[j]=0; num[t]=0; for(int k=0; k<1005; k++) { mat[j][k]=0; } } c=0; cin>>n>>m; for(int j=1; j<=m; j++) { cin>>t>>p>>alt; if(ok[p]==1) { for(int k=t-1; k>0; k--) { if(mat[p][k]==1) break; mat[p][k]=1; cnt[k]++; } } mat[p][t]=1; ok[p]=1; cnt[t]++; for(int k=1; k<=j; k++) { if(cnt[k]>alt+1) { c=1; break; } } if(c==1) { cout<<j-1<<'\n'; break; } } if(c==0) cout<<m<<'\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...