Submission #714521

#TimeUsernameProblemLanguageResultExecution timeMemory
714521mseebacherRobots (IOI13_robots)C++17
14 / 100
691 ms37748 KiB
#include <bits/stdc++.h> using namespace std; #include "robots.h" typedef long long ll; typedef vector<int> vi; #define MAXI (int)1e5 #define pb(x) push_back(x) vector<int> ad[MAXI]; vector<bool> vis(MAXI,0); void dfs(int x){ if(vis[x]) return; vis[x] = 1; for(auto s:ad[x]){ dfs(s); } } void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } int putaway(int A,int B,int T, int X[],int Y[],int W[],int S[]){ sort(X,X+A); sort(W,W+T); if(W[T-1] >= X[A-1]) return -1; multiset<int> se; for(int i = 0;i<T;i++) se.insert(W[i]); multiset<int> av; int time = 0; multiset<int>::reverse_iterator it; while(!se.empty()){ ++time; for(int i = 0;i<A;i++) av.insert(X[i]); vector<int> loe; for(it = se.rbegin();it != se.rend();it++){ if(av.size() == 0) break; if(*av.rbegin() > *it){ av.erase(av.find(*av.rbegin())); loe.push_back(*it); } } for(int i = 0;i<(int)loe.size();i++){ se.erase(se.find(loe[i])); } } return time; }

Compilation message (stderr)

robots.cpp: In function 'void setIO(std::string)':
robots.cpp:22:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  freopen((s + ".in").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
robots.cpp:23:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  freopen((s + ".out").c_str(), "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...