#include "stations.h"
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#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 <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
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 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;
template<class A=ll>
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}
template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}}
vector<ll> label(ll N, ll k, vector<ll> u, vector<ll> v)
{
vector<ll> label; REP(i,0,N) {label.pb(i);} return label;
}
ll find_next_station(ll s, ll t, vector<ll> c)
{
ll cur = t; ll prev; while(cur>s) {prev=cur; cur=(cur-1)/2;}
if(cur==s) {return prev;} else {return ((s-1)/2);}
}
Compilation message
stations.cpp: In function 'll find_next_station(ll, ll, std::vector<int>)':
stations.cpp:52:17: warning: 'prev' may be used uninitialized in this function [-Wmaybe-uninitialized]
52 | ll cur = t; ll prev; while(cur>s) {prev=cur; cur=(cur-1)/2;}
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
569 ms |
844 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
443 ms |
756 KB |
Output is correct |
2 |
Correct |
633 ms |
1080 KB |
Output is correct |
3 |
Correct |
903 ms |
756 KB |
Output is correct |
4 |
Correct |
822 ms |
868 KB |
Output is correct |
5 |
Correct |
717 ms |
736 KB |
Output is correct |
6 |
Correct |
554 ms |
848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
588 ms |
844 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
853 ms |
756 KB |
Output is correct |
2 |
Incorrect |
669 ms |
868 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
607 ms |
756 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |