답안 #397813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
397813 2021-05-03T07:42:57 Z cfalas 기지국 (IOI20_stations) C++14
8 / 100
999 ms 532 KB
#include "stations.h"
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;

#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)

vi label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vi labels(n);
	FOR(i,n) labels[i] = i;
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	//cout<<s<<" "<<t<<endl;
	int ors=s, ort=t;
	int a=s, b=t;
	while(a!=b){
		if(a>b) a=(a-1)/2;
		else b=(b-1)/2;
	}
	if(a<s) return (s-1)/2;
	//cout<<"No\n";

	int prev=-1;
	while(t){
		prev = t;
		t=(t-1)/2;
		if(s==t) break;
	}
	assert(prev!=-1);
	//cout<<ors<<" "<<ort<<" "<<2*s+2-(prev%2)<<endl;
	return 2*s+2-(prev%2);
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:32:6: warning: unused variable 'ors' [-Wunused-variable]
   32 |  int ors=s, ort=t;
      |      ^~~
stations.cpp:32:13: warning: unused variable 'ort' [-Wunused-variable]
   32 |  int ors=s, ort=t;
      |             ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 658 ms 400 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 517 ms 400 KB Output is correct
2 Correct 655 ms 532 KB Output is correct
3 Correct 918 ms 400 KB Output is correct
4 Correct 748 ms 488 KB Output is correct
5 Correct 637 ms 484 KB Output is correct
6 Correct 521 ms 400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 673 ms 400 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 999 ms 400 KB Output is correct
2 Incorrect 811 ms 400 KB Wrong query response.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 651 ms 400 KB Wrong query response.
2 Halted 0 ms 0 KB -