Submission #782799

#TimeUsernameProblemLanguageResultExecution timeMemory
782799LyricallyTeams (IOI15_teams)C++17
0 / 100
4078 ms11480 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int,int> #define pb push_back #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) int read(){int x;scanf("%d",&x);return x;} void print(int x){printf("%d\n",x);} void file(string s) { freopen((s+".in").c_str(),"r",stdin); freopen((s+".out").c_str(),"w",stdout); } const int mod=998244353; int n; struct Item { int a,b; bool operator < (Item c) const { return a<c.a; } }p[200005]; void init(int N,int A[],int B[]) { n=N; rep(i,n){p[i+1].a=A[i];} rep(i,n){p[i+1].b=B[i];} sort(p+1,p+n+1); } bool can(int m,int t[]) { sort(t,t+m); multiset<pii> st; rep1(i,n) { st.insert({p[i].a,p[i].b}); } rep(i,m) { while(!st.empty()&&t[i]<(*(st.begin())).first) { st.erase(st.begin()); } if(st.empty()){return 0;} while(!st.empty()&&((*(st.begin())).second)<t[i]){st.erase(st.begin());} if(st.empty()){return 0;} rep(j,t[i]) { if(st.empty()){return 0;} st.erase(st.begin()); } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int read()':
teams.cpp:7:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | int read(){int x;scanf("%d",&x);return x;}
      |                  ~~~~~^~~~~~~~~
teams.cpp: In function 'void file(std::string)':
teams.cpp:11:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  freopen((s+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
teams.cpp:12:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  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...