답안 #485469

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
485469 2021-11-08T00:08:26 Z PedroBigMan 장난감 기차 (IOI17_train) C++14
0 / 100
6 ms 1356 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>r) {return 0;}
	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]]=1;}
			else {type[u[i]]=2;}
		}
	}
	vector<ll> goodloop; 
	REP(i,0,N) {if(((a[i]==1 && type[i]!=1) || type[i]==0) && r[i]==1) {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-1)==0) {ans[s]=1;} else {ans[s]=0;}	
	}
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 588 KB 3rd lines differ - on the 26th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 1356 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1252 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 1356 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 588 KB 3rd lines differ - on the 26th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -