Submission #1183

# Submission time Handle Problem Language Result Execution time Memory
1183 2013-06-29T11:59:23 Z gs13068 탐사 (KOI13_probe) C++
6.08 / 19
2000 ms 420 KB
#include<cstdio>
#include<cstdlib>

bool ans[41];
int max[41];
int min[41];
int a[1000];
int b[1000];
int c[1000];
int n,m;

inline bool check()
{
	int i;
	for(i=0;i<n;i++)
	{
		if(max[b[i]]-max[a[i]-1]<c[i])return false;
		if(min[b[i]]-min[a[i]-1]>c[i])return false;
	}
	return true;
}

inline void backtracking(int x)
{
	int i;
	if(x>n)
	{
		for(i=1;i<=n;i++)printf(ans[i]?"#":"-");
		exit(0);
	}
	ans[x]=true;
	for(i=x;i<=n;i++)min[i]++;
	if(check())backtracking(x+1);
	ans[x]=false;
	for(i=x;i<=n;i++){min[i]--;max[i]--;}
	if(check())backtracking(x+1);
	for(i=x;i<=n;i++)max[i]++;
}

int main()
{
	int i;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)max[i]=i;
	for(i=0;i<m;i++)scanf("%d%d%d",&a[i],&b[i],&c[i]);
	backtracking(1);
	puts("NONE");
}

Compilation message

probe.cpp: In function 'int main()':
probe.cpp:43: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:45:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<m;i++)scanf("%d%d%d",&a[i],&b[i],&c[i]);
                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 420 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 252 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 292 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Failed 2 ms 256 KB Checker failed - contact admins or jury
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 4 ms 348 KB Checker failed - contact admins or jury
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 40 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 252 KB Output is correct
2 Execution timed out 2009 ms 256 KB Time limit exceeded
3 Halted 0 ms 0 KB -