# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1119 | jiws829 | 탐사 (KOI13_probe) | C++98 | 2084 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;
int n,m;
int p[41];
struct pp
{
int a,b,c;
int d;
}t[1001];
int che=0;
int check()
{
int i,j;
int cnt;
for(i=0;i<m;i++)
{
cnt=0;
for(j=t[i].a;j<=t[i].b;j++)
{
cnt+=p[j];
}
if(cnt!=t[i].c) return 0;
}
return 1;
}
void make(int v)
{
if(che) return;
if(v==n+1)
{
int r,i;
r=check();
if(r)
{
for(i=1;i<=n;i++)
{
if(p[i]==1) printf("#");
else printf("-");
}
che=1;
}
return;
}
make(v+1);
p[v]=1;
make(v+1);
p[v]=0;
}
int sort_n(const void *c,const void *d)
{
struct pp *x,*y;
x=(struct pp *)c;
y=(struct pp *)d;
if(x->d > y->d) return 1;
else return -1;
}
int main()
{
scanf("%d %d",&n,&m);
int i,j;
for(i=0;i<m;i++)
{
scanf("%d %d %d",&t[i].a,&t[i].b,&t[i].c);
t[i].d=t[i].b-t[i].a;
}
qsort((void *)t,m,sizeof(t[0]),sort_n);
make(1);
if(che==0) printf("NONE");
}
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... |