Submission #1093

# Submission time Handle Problem Language Result Execution time Memory
1093 2013-06-25T05:59:55 Z lmj960417 탐사 (KOI13_probe) C++
14.63 / 19
2000 ms 520 KB
#include <stdio.h>
#include <algorithm>
int n,m;
int sw=0,asw=0;
int data[50][1010],cnt[50];
int lis[1010];
int val[50];
struct gujo
{
	int st,ed,x;
};
gujo ba[1010];
void su(int x)
{
	int i,k;
	int plx=0,nonx=0;
	if(x>n)
	{
		sw=1;
		return;
	}
	for(i=1;i<=cnt[x];i++)
	{
		k=data[x][i];
		if(lis[k]==ba[k].x) plx=1;
		if(lis[k]+(ba[k].ed-x+1)==ba[k].x) nonx=1;
	}
	if(!plx)
	{
		for(i=1;i<=cnt[x];i++)
		{
			k=data[x][i];
			lis[k]++;
		}
		val[x]=1;
		su(x+1);
		if(sw) return;
		for(i=1;i<=cnt[x];i++)
		{
			k=data[x][i];
			lis[k]--;
		}
	}
	if(!nonx)
	{
		val[x]=0;
		su(x+1);
		if(sw) return;
	}
}
int main()
{
	int i,a;

	scanf("%d %d",&n,&m);

	for(i=1;i<=m;i++)
	{
		scanf("%d %d %d",&ba[i].st,&ba[i].ed,&ba[i].x);
		for(a=ba[i].st;a<=ba[i].ed;a++)
		{
			data[a][++cnt[a]]=i;
		}
		if(ba[i].ed-ba[i].st+1<ba[i].x) asw=1;
	}

	if(asw) printf("NONE\n");
	else 
	{
		su(1);
		if(sw)
		{
			for(i=1;i<=n;i++)
			{
				if(val[i]) printf("#");
				else printf("-");
			}
		}
		else printf("NONE\n");
	}

	return 0;
}

Compilation message

probe.cpp: In function 'int main()':
probe.cpp:55: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:59:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d",&ba[i].st,&ba[i].ed,&ba[i].x);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 112 ms 500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 0 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1267 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 914 ms 520 KB Output is correct
2 Correct 1304 ms 508 KB Output is correct
3 Execution timed out 2032 ms 504 KB Time limit exceeded
4 Halted 0 ms 0 KB -