Submission #165160

# Submission time Handle Problem Language Result Execution time Memory
165160 2019-11-25T11:42:13 Z Segtree Toy Train (IOI17_train) C++14
5 / 100
18 ms 1064 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#include"train.h"
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
#define N 5010
vector<int> g[N];
vector<int> who_wins(vector<int> a,vector<int> r,vector<int> u,vector<int> v){
    ll n=a.size(),m=u.size();
    bool th[N];
    for(int i=0;i<n;i++)th[i]=0;
    for(int i=0;i<m;i++){
	if(u[i]==v[i])th[u[i]]=1;
	else g[u[i]].push_back(v[i]);
    }
    vector<int> ans(n);
    for(int i=0;i<n;i++){
	int ok=-1;
	for(int j=i;j<n;j++){
	    if(th[j]==1&&a[j]==1&&r[j]==1){ok=1; break;}
	    if(th[j]==1&&a[j]==0&&r[j]==0){ok=0; break;}
	    if(g[j].size()==0){
		ok=r[j];
		break;
	    }
	}
	ans[i]=ok;
    }
    return ans;
}
/*
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
}*/

# Verdict Execution time Memory Grader output
1 Correct 6 ms 760 KB Output is correct
2 Correct 6 ms 760 KB Output is correct
3 Correct 6 ms 764 KB Output is correct
4 Correct 6 ms 888 KB Output is correct
5 Correct 6 ms 888 KB Output is correct
6 Correct 6 ms 888 KB Output is correct
7 Correct 6 ms 888 KB Output is correct
8 Correct 6 ms 888 KB Output is correct
9 Correct 6 ms 888 KB Output is correct
10 Correct 6 ms 888 KB Output is correct
11 Correct 5 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 1016 KB 3rd lines differ - on the 1664th token, expected: '0', found: '-1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 988 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 17 ms 1064 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 Correct 6 ms 760 KB Output is correct
2 Correct 6 ms 760 KB Output is correct
3 Correct 6 ms 764 KB Output is correct
4 Correct 6 ms 888 KB Output is correct
5 Correct 6 ms 888 KB Output is correct
6 Correct 6 ms 888 KB Output is correct
7 Correct 6 ms 888 KB Output is correct
8 Correct 6 ms 888 KB Output is correct
9 Correct 6 ms 888 KB Output is correct
10 Correct 6 ms 888 KB Output is correct
11 Correct 5 ms 760 KB Output is correct
12 Incorrect 2 ms 504 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -