제출 #1143126

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