답안 #296069

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
296069 2020-09-10T08:42:08 Z Muhammetali 장난감 기차 (IOI17_train) C++11
0 / 100
10 ms 2072 KB
#include "train.h"
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v)
{
	vi res(a.size());
	deque<int>g,gg;
	set<int>s[6000];
	for (int i=0;i<sz(u);i++)s[u[i]].ins(v[i]);;
	for (int i=0;i<sz(a);i++)
	{
		if (s[i].count(i)==1)
		{
			if (a[i]==0 && r[i]==0) g.pb(i);
			if (r[i]==1)
			{
				if (a[i]==1)gg.pb(i);
				if (s[i].size()==1)gg.pb(i);
			}
		}
	}
	for (int i=0;i<sz(a);i++)
	{
		while(i>g.front() && sz(g)>0)g.pop_front();
		while(i>gg.front() && sz(gg)>0)gg.pop_front();
		if (sz(g)==0 && sz(gg)==0)break;
		if (sz(g)==0)res[i]=1;
		else if (sz(gg)==0)res[i]=0;
		else if (g.front()<gg.front())res[i]=0;
		else res[i]=1;
	}
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1152 KB Output is correct
2 Correct 5 ms 1152 KB Output is correct
3 Correct 5 ms 1152 KB Output is correct
4 Incorrect 5 ms 1152 KB 3rd lines differ - on the 1462nd token, expected: '0', found: '1'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 644 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 2048 KB Output is correct
2 Correct 10 ms 2048 KB Output is correct
3 Correct 10 ms 2048 KB Output is correct
4 Incorrect 10 ms 2072 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1664 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 2048 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1152 KB Output is correct
2 Correct 5 ms 1152 KB Output is correct
3 Correct 5 ms 1152 KB Output is correct
4 Incorrect 5 ms 1152 KB 3rd lines differ - on the 1462nd token, expected: '0', found: '1'
5 Halted 0 ms 0 KB -