Submission #50648

#TimeUsernameProblemLanguageResultExecution timeMemory
50648Mamnoon_SiamTeams (IOI15_teams)C++17
21 / 100
4038 ms12968 KiB
#include "teams.h" //#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; #define debug(s) cout<< #s <<" = "<< s <<endl #define all(v) (v).begin(), (v).end() #define KeepUnique(v) (v).erase( unique(all(v)), v.end() ) #define MEMSET(a,val) memset(a, val, sizeof a) #define PB push_back #define endl '\n' inline int myrand(int l, int r) { int ret = rand(); ret <<= 15; ret ^= rand(); if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l; return ret; } template <typename F, typename S> ostream& operator << (ostream& os, const pair< F, S>& p) { return os<<"(" <<p.first<<", "<<p.second<<")"; } typedef pair<int, int> ii; template<typename T> using min_pq = priority_queue<T, vector<T>, greater<T> >; //int dx[] = {-1, +0, +1, +0}; //int dy[] = {+0, +1, +0, -1}; int n; vector<int> L, R; void init(int N, int A[], int B[]) { L.resize(N); R.resize(N); n = N; for(int i = 0; i < N; i++) { L[i] = A[i]; R[i] = B[i]; } vector<ii> temp; for(int i = 0; i < n; i++) { temp.push_back(ii(R[i], L[i])); } sort(all(temp)); for(int i = 0; i < n; i++) { L[i] = temp[i].second; R[i] = temp[i].first; } } int can(int M, int K[]) { sort(K, K + M); int s = 0; for(int i = 0; i < M; i++) s += K[i]; if(s > n) return 0; vector<int> ok(n); for(int i = 0; i < M; i++) { int k = K[i]; while(k--) { int id = -1; for(int j = 0; j < n; j++) { if(ok[j]) continue; if(L[j] <= K[i] and K[i] <= R[j]) { id = j; break; } } if(id == -1) return 0; ok[id] = 1; } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int myrand(int, int)':
teams.cpp:17:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
  ^~
teams.cpp:17:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
                          ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...