Submission #485466

# Submission time Handle Problem Language Result Execution time Memory
485466 2021-11-08T00:00:51 Z PedroBigMan Toy Train (IOI17_train) C++14
0 / 100
5 ms 844 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include "train.h"
using namespace std;
typedef int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll)a; i<(ll)b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 100000000000000000LL
ll insig;
#define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);}
void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
vector<ll> ps;

ll PS(ll l, ll r)
{
	if(l==0) {return ps[r];}
	else {return (ps[r]-ps[l-1]);}
}

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) 
{
 	ll N = a.size(); ll M = u.size();
	vector<ll> type; //type 0: connects to itself, type 1: connects to next, type 2: connects to both
	REP(i,0,N) {type.pb(-1);} 
	REP(i,0,M)
	{
		if(u[i]==v[i])
		{
			if(type[u[i]]==-1) {type[u[i]]=0;}
			else {type[u[i]]=2;}
		}
		else
		{
			if(type[u[i]]==-1) {type[u[i]]=0;}
			else {type[u[i]]=2;}
		}
	}
	vector<ll> goodloop; 
	REP(i,0,N) {if((a[i]==1 && type[i]!=1) || type[i]==0) {goodloop.pb(i);}}
	vector<ll> ans; REP(i,0,N) {ans.pb(-1);}
	vector<ll> Bloop; REP(i,0,N) {Bloop.pb(0); if(type[i]!=1 && a[i]==0) {Bloop[i]=1;}}
	ll cursum=0; REP(i,0,N) {cursum+=Bloop[i]; ps.pb(cursum);}
	REP(s,0,N)
	{
		ll nxt = *lower_bound(whole(goodloop),s);
		if(PS(s,nxt)==0) {ans[s]=1;} else {ans[s]=0;}	
	}
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 588 KB 3rd lines differ - on the 3rd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 844 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 716 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 744 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 588 KB 3rd lines differ - on the 3rd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -