답안 #954953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954953 2024-03-29T00:51:28 Z irmuun 기지국 (IOI20_stations) C++17
5 / 100
588 ms 1020 KB
#include<bits/stdc++.h>
#include "stations.h"
 
using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

vector<int>label(int n,int k,vector<int>u,vector<int>v){
    vector<int>l(n);
    vector<int>adj[n];
    for(int i=0;i<n-1;i++){
        adj[u[i]].pb(v[i]);
        adj[v[i]].pb(u[i]);
    }
    int mx=0;
    for(int i=0;i<n;i++){
        mx=max(mx,(int)adj[i].size());
    }
    if(mx<=2){
        vector<int>ord;
        function <void(int,int)> dfs=[&](int x,int p){
            ord.pb(x);
            for(auto y:adj[x]){
                if(y!=p){
                    dfs(y,x);
                }
            }
        };
        for(int i=0;i<n;i++){
            if(adj[i].size()==1){
                dfs(i,-1);
                break;
            }
        }
        for(int i=0;i<n;i++){
            l[ord[i]]=i;
        }
        return l;
    }
    iota(all(l),1000);
    return l;
}

int find_next_station(int s,int t,vector<int>c){
    if(s>=1000){
        if(t<s) return c[0];
        for(int i=1;i<c.size();i++){
            int p=c[i]-1000,T=t-1000;
            while(T>p){
                T=(T-1)/2;
            }
            if(T==p){
                return c[i];
            }
        }
        return c[0];
    }
    else{
        if(s>t) return c[0];
        return c.back();
    }
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:52:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         for(int i=1;i<c.size();i++){
      |                     ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 330 ms 784 KB Output is correct
2 Correct 295 ms 932 KB Output is correct
3 Correct 567 ms 684 KB Output is correct
4 Correct 409 ms 684 KB Output is correct
5 Correct 377 ms 684 KB Output is correct
6 Correct 278 ms 936 KB Output is correct
7 Correct 288 ms 684 KB Output is correct
8 Correct 1 ms 764 KB Output is correct
9 Correct 2 ms 944 KB Output is correct
10 Correct 1 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 508 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1001
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 314 ms 932 KB Output is correct
2 Correct 281 ms 928 KB Output is correct
3 Correct 560 ms 684 KB Output is correct
4 Correct 414 ms 684 KB Output is correct
5 Correct 354 ms 684 KB Output is correct
6 Correct 299 ms 940 KB Output is correct
7 Correct 259 ms 684 KB Output is correct
8 Correct 1 ms 768 KB Output is correct
9 Correct 3 ms 1020 KB Output is correct
10 Correct 0 ms 768 KB Output is correct
11 Incorrect 425 ms 684 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 588 ms 684 KB Output is correct
2 Correct 415 ms 688 KB Output is correct
3 Correct 384 ms 684 KB Output is correct
4 Correct 2 ms 764 KB Output is correct
5 Correct 2 ms 768 KB Output is correct
6 Correct 2 ms 768 KB Output is correct
7 Incorrect 412 ms 684 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 339 ms 684 KB Output is correct
2 Correct 270 ms 932 KB Output is correct
3 Correct 580 ms 684 KB Output is correct
4 Correct 401 ms 936 KB Output is correct
5 Correct 375 ms 684 KB Output is correct
6 Correct 281 ms 936 KB Output is correct
7 Correct 276 ms 684 KB Output is correct
8 Correct 1 ms 768 KB Output is correct
9 Correct 3 ms 776 KB Output is correct
10 Correct 1 ms 768 KB Output is correct
11 Partially correct 284 ms 876 KB Partially correct
12 Partially correct 336 ms 948 KB Partially correct
13 Correct 571 ms 684 KB Output is correct
14 Correct 413 ms 684 KB Output is correct
15 Correct 393 ms 940 KB Output is correct
16 Partially correct 257 ms 684 KB Partially correct
17 Incorrect 373 ms 684 KB Wrong query response.
18 Halted 0 ms 0 KB -