Submission #772442

#TimeUsernameProblemLanguageResultExecution timeMemory
772442ono_de206Stations (IOI20_stations)C++14
0 / 100
749 ms568 KiB
#include "stations.h"
#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// #define int long long
 
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels(n);
	for (int i = 0; i < n; i++) {
		labels[i] = i + 1;
	}
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	auto check = [&](int mn, int mx) -> bool {
		while(mx > 0) {
			if(mx == mn) return true;
			mx >>= 1;
		}
		return false;
	};
	if(t < s || !check(s, t)) return c[0];
	for(int i = 0; i < c.size(); i++) {
		if(check(c[i], t)) return c[i];
	}
	return c[0];
}

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for(int i = 0; i < c.size(); i++) {
      |                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...