Submission #431118

#TimeUsernameProblemLanguageResultExecution timeMemory
431118davi_bartRoller Coaster Railroad (IOI16_railroad)C++17
30 / 100
330 ms16796 KiB
#include "railroad.h" #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define ld long double #define pb push_back long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); multiset<pair<int,int> > k; for(int i=0;i<s.size();i++)k.insert({s[i],i}); int c=0; for(int i=0;i<s.size();i++){ auto y=k.lower_bound({t[i],-1000}); if(y!=k.end() && y->se==i)y=next(y); if(y==k.end())c++; else { //cout<<t[i]<<endl; k.erase(y); } } //cout<<"c: "<<c<<endl; return c>1; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:14:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i=0;i<s.size();i++)k.insert({s[i],i});
      |                 ~^~~~~~~~~
railroad.cpp:16:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=0;i<s.size();i++){
      |                 ~^~~~~~~~~
railroad.cpp:12:9: warning: unused variable 'n' [-Wunused-variable]
   12 |     int n = (int) s.size();
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...