답안 #149760

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149760 2019-09-01T07:07:07 Z Greedy left the chat.(#3618, miguel, claudy, MvC) Bulb Game (FXCUP4_bulb) C++17
36 / 100
1000 ms 10140 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=3e5+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;
				s[j]^=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")
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 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
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 6 ms 380 KB Output is correct
21 Correct 7 ms 376 KB Output is correct
22 Correct 4 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 4 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 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
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 6 ms 380 KB Output is correct
21 Correct 7 ms 376 KB Output is correct
22 Correct 4 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 4 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 143 ms 10140 KB Output is correct
28 Correct 81 ms 10136 KB Output is correct
29 Execution timed out 1051 ms 10016 KB Time limit exceeded
30 Halted 0 ms 0 KB -