제출 #386000

#제출 시각아이디문제언어결과실행 시간메모리
386000ismoilovDetecting Molecules (IOI16_molecules)C++14
69 / 100
53 ms4064 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 && r < n) 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; }

컴파일 시 표준 에러 (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...