제출 #1137185

#제출 시각아이디문제언어결과실행 시간메모리
1137185thunoproStations (IOI20_stations)C++20
0 / 100
306 ms5224 KiB
#include<bits/stdc++.h> using namespace std ; #define maxn 200009 #define ll long long #define pb push_back #define fi first #define se second #define left id<<1 #define right id<<1|1 #define re exit(0); #define _lower(x) lower_bound(v.begin(),v.end(),x)-v.begin()+1 #define TIME ( 1.0*clock() / CLOCKS_PER_SEC ) const int mod = 1e9+7 ; const int INF = 1e9 ; typedef vector<int> vi ; typedef pair<int,int> pii ; typedef vector<pii> vii ; template < typename T > void chkmin ( T &a , T b ) { if ( a > b ) a = b ; } template < typename T > void chkmax ( T &a , T b ) { if ( a < b ) a = b ; } void add ( int &a , int b ) { a += b ; if ( a >= mod ) a -= mod ; if ( a < 0 ) a += mod ; } void rf () { freopen ("bai1.inp","r",stdin) ; } mt19937 rng (time(0)) ; int _pow ( int a , int n ) { if ( n == 0 ) return 1 ; int res = _pow (a,n/2) ; if ( n % 2 ) return 1ll*res*res%mod*a%mod ; else return 1ll*res*res%mod ; } vi label ( int n , int k , vi u , vi v ) ; int find_next_station ( int source , int target , vi list ) ; int n , k ; vi adjList [maxn] ; vi Label ; int timeDfs ; void dfs ( int u , int par = -1 ) { Label [u] = timeDfs ++ ; for ( auto v : adjList [u] ) { if ( v == par ) continue ; dfs (v,u) ; } } void reset () { timeDfs = 0 ; Label . assign (n,0) ; for ( int i = 0 ; i < n ; i ++ ) adjList [i] . clear () ; } vi label ( int N , int K , vi U , vi V ) { n = N , k = K ; reset () ; for ( int i = 0 ; i < U.size () ; i ++ ) { int u = U [i] , v = V [i] ; adjList [u] . pb (v) ; adjList [v] . pb (u) ; } dfs (0) ; return Label ; } int find_next_station ( int source , int target , vi list ) { sort (list.begin(),list.end()) ; if ( source > target ) { return list [0] ; } else { return *(--upper_bound(list.begin(),list.end(),target)) ; } } //int main () //{ // ios_base::sync_with_stdio(0); // cin.tie(0);cout.tie(0); //// rf () ; // vi answer_Label = label(5, 10, {0, 1, 1, 2}, {1, 2, 3, 4}) ; // for ( auto x : answer_Label ) cout << x << " " ; cout << "\n" ; // int source , target ; cin >> source >> target ; // int source_x , target_x ; // for ( int i = 0 ; i < answer_Label.size () ; i ++ ) // { // if ( answer_Label [i] == source ) source_x = i ; // if ( answer_Label [i] == target ) target_x = i ; // } // cout << "source target: " << source_x << " " << target_x << "\n" ; // vi neigh ; // for ( auto x : adjList[source_x] ) neigh . pb (answer_Label[x]) ; // cout << find_next_station (source,target,neigh) ; //}

컴파일 시 표준 에러 (stderr) 메시지

stations.cpp: In function 'void rf()':
stations.cpp:32:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen ("bai1.inp","r",stdin) ;
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...