# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1143186 | victor_c | Inspector (POI13_ins) | C++20 | 2 ms | 1352 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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |