제출 #725578

#제출 시각아이디문제언어결과실행 시간메모리
725578HaroldVemenoDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> #ifdef GUDEB #define D(x) cerr << #x << ": " << (x) << '\n'; #define ifdeb if(true) #else #define D(x) ; #define ifdeb if(false) #endif #define all(x) begin(x), end(x) using namespace std; using ull = unsigned long long; using ll = long long; // #define int ll; vector<int> find_subset(int l, int u, vector<int> ws) { sort(all(ws)); int n = ws.size(); ll s = 0; int be = n; int eb = n; for(int i = 0; i < ws.size(); ++i) s += ws[i]; while(true) { if(s > u) { if(be == 0) return {}; --be; s -= ws[be]; } else if(s < l) { if(eb == be) return {}; --eb; s += ws[eb]; } else { vector<int> res; for(int i = 0; i < be; ++i) res.push_back(ws[i]); for(int i = eb; i < n; ++i) res.push_back(ws[i]); return res; } } }

컴파일 시 표준 에러 (stderr) 메시지

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:25:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i = 0; i < ws.size(); ++i) s += ws[i];
      |                    ~~^~~~~~~~~~~
#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...