Submission #422225

# Submission time Handle Problem Language Result Execution time Memory
422225 2021-06-09T22:08:09 Z Pbezz Toy Train (IOI17_train) C++14
0 / 100
24 ms 736 KB
#include "train.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;

typedef tree<ll, null_type,less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ll MAXN = 2e5+4;
const ll INF = 1e9+7;


std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
//vai de u para v

	int n =(int)a.size(),m=(int)u.size(),i,cur;

	bool self[n],next[n];

	for(i=0;i<n;i++){
	self[i]=false;
	next[i]=false;
	}

	for(i=0;i<m;i++){

	if(u[i]==v[i]){
	self[u[i]]=true;
	}else{
	next[u[i]]=true;
	}

	}

/*
2 3
0 1
1 0
0 0
0 1
1 1
*/
	std::vector<int> res(n);
	for(i=0;i<n;i++){cur=i;
	cout<<i<<endl;
	while(1){//cout<<cur<<" "<<self[cur]<<" "<<next[cur]<<endl;

	while(self[cur]==false)cur++;//pelo menos o ultimo tem de ter

	if(a[cur]==r[cur] ){
	res[i]=a[cur]; break;
	}

	if(next[cur]==0){//trapped
	res[i]=r[cur]; break;
	}
	cur++;

	}


}



	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 460 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 716 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 636 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 736 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 460 KB secret mismatch
2 Halted 0 ms 0 KB -