Submission #980900

# Submission time Handle Problem Language Result Execution time Memory
980900 2024-05-12T15:29:41 Z vjudge1 Beech Tree (IOI23_beechtree) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repr(a,b,c) for(int a=b-1; a>c-1; a--)
#define repa(a,b) for(auto a:b)
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define pb push_back

using namespace std;

vector<int> beechtree(int N, int M, vector<int> P, vector<int> C){
	vector<int> ans(N);
	if(N>8) return ans;
	vector<int> subt[N];
	rep(i,0,N) subt[i].pb(i);
	repr(i,N,1) repa(e,subt[i]) subt[P[i]].pb(e);
	rep(i,0,N){
		ans[i]=0;
		do{
			int e, cont;
			vector<int> s;
			rep(j,1,subt[i].size()){
				cont=0;
				e=subt[i][j];
				repa(e,s) if(e==C[e]) cont++; 
				if(e==i || P[e]!=cont) break;
				if(j==subt[i].size()-1) ans[i]=1;
				else s.pb(C[e]);
			}
		}while(next_permutation(subt[i].begin(),subt[i].end()));
	}
	return ans;
}

Compilation message

beechtree.cpp: In function 'std::vector<int> beechtree(int, int, std::vector<int>, std::vector<int>)':
beechtree.cpp:2:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define rep(a,b,c) for(int a=b; a<c; a++)
......
   25 |    rep(j,1,subt[i].size()){
      |        ~~~~~~~~~~~~~~~~~~         
beechtree.cpp:25:4: note: in expansion of macro 'rep'
   25 |    rep(j,1,subt[i].size()){
      |    ^~~
beechtree.cpp:30:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     if(j==subt[i].size()-1) ans[i]=1;
      |        ~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -