#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[i]==-1) {type[i]=0;}
else {type[i]=2;}
}
else
{
if(type[i]==-1) {type[i]=0;}
else {type[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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
716 KB |
3rd lines differ - on the 3rd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
1612 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
1356 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6 ms |
1612 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
716 KB |
3rd lines differ - on the 3rd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |