Submission #942365

#TimeUsernameProblemLanguageResultExecution timeMemory
942365Nika533Detecting Molecules (IOI16_molecules)C++14
69 / 100
35 ms5148 KiB
#pragma GCC diagnostic warning "-std=c++11" #include <bits/stdc++.h> #include "molecules.h" #define pb push_back #define f first #define s second #define MOD 1000000007 #define flush fflush(stdout) #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(), (x).rend() #define pii pair<int,int> using namespace std; int n,T,k; vector<int> find_subset(int l, int u, vector<int> W) { vector<int> v; n=W.size(); pii arr[n+1]; int pref[n+1],suf[n+2]; pref[0]=0; suf[n+1]=0; for (int i=1; i<=n; i++) { arr[i].f=W[i-1]; arr[i].s=i-1; } sort(arr+1,arr+n+1); for (int i=1; i<=n; i++) { pref[i]=pref[i-1]+arr[i].f; } for (int i=n; i>=1; i--) { suf[i]=suf[i+1]+arr[i].f; } for (int sz=1; sz<=n; sz++) { if (suf[n-sz+1]<l) continue; else { for (int i=0; i<=sz; i++) { if (pref[sz-i]+suf[n-i+1]>=l && pref[sz-i]+suf[n-i+1]<=u) { for (int j=1; j<=sz-i; j++) v.pb(arr[j].s); for (int j=n-i+1; j<=n; j++) v.pb(arr[j].s); return v; } } break; } } return v; }

Compilation message (stderr)

molecules.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...