Submission #1061351

# Submission time Handle Problem Language Result Execution time Memory
1061351 2024-08-16T08:12:48 Z vjudge1 Toy Train (IOI17_train) C++17
0 / 100
6 ms 880 KB
#include <bits/stdc++.h>
#include "train.h"

using namespace std;

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	vector<int> V,v1;
	int n=a.size(),m=u.size();
	bool edg[n]={};
	for (int i=0;i<m;i++)
	{
		if (u[i]==v[i])
		{
			if (a[u[i]] && r[u[i]])
				V.push_back(u[i]);
			else if(!a[u[i]] && !r[u[i]])
				v1.push_back(u[i]);
		}
		else
			edg[u[i]]=1;
	}
	int rc[n];
	rc[n-1]=n-1;
	for (int i=n-2;i>=0;i--)
		if (edg[i])
			rc[i]=rc[i+1];
		else
			rc[i]=i;
	vector<int> ans(n);
	for (int i=0;i<n;i++)
	{
		int x=lower_bound(V.begin(),V.end(),i)-begin(V);
		if (x!=V.size())
			if (V[x]<=rc[i])
			{
				int y=lower_bound(v1.begin(),v1.end(),V[x])-begin(v1)-1;
				if (y<0 or v1[y]>V[x])
					ans[i]=1;
			}
	}
	return ans;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:33:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   if (x!=V.size())
      |       ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 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 Correct 6 ms 856 KB Output is correct
2 Correct 3 ms 628 KB Output is correct
3 Correct 3 ms 872 KB Output is correct
4 Incorrect 3 ms 880 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 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 860 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 2 ms 600 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -