Submission #1119

#TimeUsernameProblemLanguageResultExecution timeMemory
1119jiws829탐사 (KOI13_probe)C++98
4.56 / 19
2084 ms376 KiB
#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)

probe.cpp: In function 'int main()':
probe.cpp:65:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j;
        ^
probe.cpp:63:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
probe.cpp:69:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d",&t[i].a,&t[i].b,&t[i].c);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...