#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr)
#define FOR(i, begin, end) for(int i = (begin); i < (end); i++)
#define TSTS int ttt; cin >> ttt; while(ttt--) solve()
#define all(x) (x).begin(), (x).end()
#define le(vec) vec[vec.size()-1]
#define sz(x) ((int)((x).size()))
#define pb push_back
#define s second
#define f first
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pdd;
const int INF=1e9, MOD=1e9+7, mod=998244353;
const ll LINF=1e18;
void setIO()
{
FAST_IO;
}
void setIO(string s)
{
FAST_IO;
freopen((s+".in").c_str(), "r", stdin);
freopen((s+".out").c_str(), "w", stdout);
}
const int N=1e3+10;
int cc[N], id;
vi ad[N];
void dfs(int u, int pst)
{
cc[u]=id; id--;
for(auto x : ad[u]){
if(x==pst) continue;
dfs(x, u);
}
}
vi label(int n, int k, vi u, vi v)
{
FOR(i, 0, n) ad[i].clear(), cc[i]=0;
FOR(i, 0, n-1)
{
ad[u[i]].pb(v[i]);
ad[v[i]].pb(u[i]);
}
id=n-1;
dfs(0, -1);
vi ans(n);
FOR(i, 0, n) ans[i]=cc[i], assert(cc[i]<=k);
return ans;
}
int find_next_station(int s, int t, vi c)
{
if(s<t) return le(c);
for(auto x : c){
if(x>=t) return x;
}
}
Compilation message
stations.cpp: In function 'void setIO(std::string)':
stations.cpp:32:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
32 | freopen((s+".in").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stations.cpp:33:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
33 | freopen((s+".out").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, vi)':
stations.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
70 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
501 ms |
600 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
421 ms |
508 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
524 ms |
508 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
845 ms |
716 KB |
Output is correct |
2 |
Correct |
661 ms |
512 KB |
Output is correct |
3 |
Incorrect |
563 ms |
404 KB |
Wrong query response. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
515 ms |
516 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |