제출 #1029645

#제출 시각아이디문제언어결과실행 시간메모리
102964512345678Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
481 ms57680 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; const int nx=2e5+5; int n, T, cnts, cntt, lst=INT_MAX; map<int, int> mp; vector<int> vt[2*nx], vs[2*nx]; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { n=s.size(); for (int i=0; i<n;i ++) mp[s[i]]=mp[t[i]]=0; for (auto &[x, y]:mp) y=++T; for (int i=0; i<n;i ++) vs[mp[s[i]]].push_back(i), vt[mp[t[i]]].push_back(i); //cout<<"mp "<<mp[s[i]]<<' '<<mp[t[i]]<<'\n'; for (int i=2*n; i>=1; i--) { for (auto x:vs[i]) cnts++; if (vt[i].size()>1) lst=i; for (auto x:vt[i]) { cntt++; int vl=cnts; if (s[x]>=t[x]&&s[x]<lst) vl--; //cout<<"x "<<x<<' '<<vl<<' '<<cntt<<'\n'; if (vl<cntt-1) return 1; } lst=i; } return 0; }

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

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:19:19: warning: unused variable 'x' [-Wunused-variable]
   19 |         for (auto x:vs[i]) cnts++;
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...