제출 #567795

#제출 시각아이디문제언어결과실행 시간메모리
567795hhhhaura즐거운 행로 (APIO20_fun)C++14
26 / 100
119 ms17256 KiB
#include "fun.h" #define wiwihorz #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("sse") #pragma loop-opt(on) #define rep(i, a, b) for(int i = a; i <= b; i ++) #define rrep(i, a, b) for(int i = b; i >= a; i --) #define all(x) x.begin(), x.end() #define ceil(a, b) ((a + b - 1) / (b)) #define ll long long int #define lld long double #define pii pair<int, int> #define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()) #define INF 2000000000 #define MOD 1000000007 #define eps (1e-9) using namespace std; #ifdef wiwihorz #define print(a...)cerr<<"Line "<<__LINE__<<":",kout("["+string(#a)+"] = ", a) void vprint(auto L,auto R){while(L<R)cerr<<*L<<" \n"[next(L) == R], ++L; } void kout() { cerr << endl; } template<class T1,class ... T2>void kout(T1 a,T2 ... e){cerr<<a<<" ",kout(e...);} #else #define print(...) 0 #define vprint(...) 0 #endif int n; vector<int> vis; vector<vector<int>> mp; int find_farthest(int x) { vector<int> dis(n, INF); queue<int> q; q.push(x); dis[x] = 0; while(q.size()) { int cur = q.front(); q.pop(); for(auto i : mp[cur]) { if(dis[i] != INF) continue; dis[i] = dis[cur] + 1; q.push(i); } } int best = 0, id = -1; rep(i, 0, n - 1) if(!vis[i]) { if(dis[i] > best) { best = dis[i]; id = i; } } return id; } vector<int> createFunTour(int N, int Q) { n = N; vector<int> ans; mp.assign(N, vector<int>()); vis.assign(N, 0); rep(i, 0, N - 1) rep(j, 0, i - 1) { if(hoursRequired(i, j) == 1) { mp[i].push_back(j); mp[j].push_back(i); } } int st = find_farthest(0); st = find_farthest(st); vis[st] = 1; ans.push_back(st); rep(i, 1, N - 1) { st = find_farthest(st); vis[st] = 1; ans.push_back(st); } return ans; }

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

fun.cpp:6: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    6 | #pragma loop-opt(on)
      | 
fun.cpp:21:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   21 | void vprint(auto L,auto R){while(L<R)cerr<<*L<<" \n"[next(L) == R], ++L; }
      |             ^~~~
fun.cpp:21:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   21 | void vprint(auto L,auto R){while(L<R)cerr<<*L<<" \n"[next(L) == R], ++L; }
      |                    ^~~~
#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...