제출 #916400

#제출 시각아이디문제언어결과실행 시간메모리
916400biank철로 (IOI14_rail)C++14
8 / 100
55 ms848 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; #define ALL(x) x.begin(),x.end() #define forn(i,n) for(int i=0;i<int(n);i++) #define forsn(i,s,n) for(int i=int(s);i<int(n);i++) #define fst first #define snd second typedef pair<int,int> ii; const int C = 1, D = 2; //int getDistance(int i, int j); void findLocation(int n, int first, int loc[], int stype[]) { vector<ii> p(n); forsn(i,1,n) p[i]={getDistance(0,i),i}; sort(ALL(p)); set<ii> Cs, Ds; for(auto [d0,i]:p) { if(Cs.empty()) { loc[i]=first; stype[i]=C; Cs.insert((ii){loc[i],i}); continue; } int minC = Cs.begin()->snd; if(Ds.empty()) { loc[i]=loc[minC]+d0; stype[i]=D; Ds.insert((ii){loc[i],i}); continue; } int maxD = Ds.rbegin()->snd; int distItoC = getDistance(i,minC); int distItoD = getDistance(maxD,i); /*loc[i] = loc[minC] + distItoC; int target = (loc[i] + loc[maxD] - distItoD)/2; auto it = Cs.lower_bound((ii){target,0}); if(it != Cs.end() && loc[i] - it->fst + loc[maxD] - it->fst == distItoD) { stype[i] = D; Ds.insert((ii){loc[i],i}); continue; } loc[i] = loc[maxD] - distItoD; target = (distItoC + loc[i] + loc[minC])/2; it = Ds.lower_bound((ii){target,0}); if(it != Ds.end() && it->fst - loc[i] + it->fst - loc[minC] == distItoC) { stype[i] = C; Cs.insert((ii){loc[i],i}); continue; }*/ loc[i] = loc[minC] + distItoC; if(d0 == loc[i] - loc[0]) { stype[i] = D; Ds.insert((ii){loc[i],i}); } else { loc[i] = loc[maxD] - distItoD; stype[i] = C; Cs.insert((ii){loc[i],i}); } } }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:20:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   20 |     for(auto [d0,i]:p) {
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...