답안 #1119

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1119 2013-06-26T06:05:45 Z jiws829 탐사 (KOI13_probe) C++
4.56 / 19
2000 ms 376 KB
#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

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);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 10 ms 360 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2084 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 376 KB Output is correct
2 Correct 352 ms 376 KB Output is correct
3 Correct 1643 ms 368 KB Output is correct
4 Correct 7 ms 364 KB Output is correct
5 Execution timed out 2029 ms 376 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2025 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2044 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -