# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
16230 | eaststar | 탐사 (KOI13_probe) | C++14 | 3 ms | 376 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 <stdio.h>
#include <algorithm>
using namespace std;
struct data{
int s,e,w;
}a[1010];
int ans[41];
int main(){
int i,j,k,n;
scanf("%d%d",&k,&n);
for(i=1;i<=n;++i){
scanf("%d%d%d",&a[i].s,&a[i].e,&a[i].w);
--a[i].s;
}
for(i=1;i<=k;++i)ans[i]=i;
for(i=1;i<=k;++i){
for(j=0;j<k;++j){
ans[j+1]=min(ans[j+1],ans[j]+1);
ans[j]=min(ans[j],ans[j+1]);
}
for(j=1;j<=n;++j){
ans[a[j].e]=min(ans[a[j].e],ans[a[j].s]+a[j].w);
ans[a[j].s]=min(ans[a[j].s],ans[a[j].e]-a[j].w);
}
}
for(i=1;i<=k;++i)if(ans[i]<0||ans[i]-ans[i-1]>1)break;
if(i>k)for(i=1;i<=k;++i)printf("%c",ans[i]-ans[i-1]?'#':'-');
else puts("NONE");
return 0;
}
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... |