Submission #148672

# Submission time Handle Problem Language Result Execution time Memory
148672 2019-09-01T04:54:20 Z Greedy left the chat.(#3618, miguel, claudy, MvC) Bulb Game (FXCUP4_bulb) C++17
0 / 100
2 ms 376 KB
#include "bulb.h"
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<61);
const int inf=(1<<30);
const int nmax=1e3+50;
const int mod=1e9+7;
using namespace std;
int n,t,i,j,b,s[nmax],l[nmax],r[nmax];
int dfs(int x)
{
	if(x<0)return x;
	if(s[x])return dfs(r[x]);
	else return dfs(l[x]);
}
int FindWinner(int T,vector<int> L,vector<int> R)
{
	n=L.size(),t=T;
	for(i=0;i<n;i++)
	{
		l[i]=L[i];
		r[i]=R[i];
	}
	for(i=0;i<n;i++)
	{
		s[i]^=1;
		b=0;
		for(j=0;j<n;j++)
		{
			s[j]^=1;
			if(dfs(0)==-2)
			{
				b=1;
				break;
			}
			s[j]^=1;
		}
		if(!b)return 1;
		s[i]^=1;
	}
	return 0;
}

Compilation message

bulb.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
bulb.cpp:4:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -