Submission #385999

#TimeUsernameProblemLanguageResultExecution timeMemory
385999ismoilovDetecting Molecules (IOI16_molecules)C++14
46 / 100
4 ms748 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++) #define pb push_back #define ss second #define ff first vector<int> find_subset(int l1, int u, vector<int> ww) { vector <pair<int, int>> w; int n = ww.size(), ans = 0; fp(i,0,n) w.pb({ww[i], i}); sort(all(w)); int l = 0, r = 0; while(l < n || r < n) { if(ans < l1) ans += w[r].ff, r ++; else ans -= w[l].ff, l ++; if(ans >= l1 && ans <= u) break; } vector <int> x; if(ans > u || ans < l1) return x; fp(i,l,r) x.pb(w[i].ss); return x; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
molecules.cpp:16:2: note: in expansion of macro 'fp'
   16 |  fp(i,0,n)
      |  ^~
molecules.cpp:7:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
molecules.cpp:32:2: note: in expansion of macro 'fp'
   32 |  fp(i,l,r)
      |  ^~
#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...