제출 #1127194

#제출 시각아이디문제언어결과실행 시간메모리
1127194heeyDetecting Molecules (IOI16_molecules)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5+2; #include "molecules.h" vector<int> find_subset(int l, int u, vector<int> w){ int n = w.size(); vector<pair<int,int>> sigma(n); for(int i = 0; i < n; i++){ sigma[i] = {w[i], i}; } sort(sigma.begin(), sigma.end()); vector<bool> us(n, false); int L = 0, R = n-1; long long sum = 0; int t = n-1; while(L < R && (sum > u || sum < l)){ us[R] = true; sum += sigma[R--].first; while(L < R && t > R && sum > u){ us[t] = false; us[L] = true; sum -= sigma[t--].first; sum += sigma[L++].first; } } int res = 0; vector<int> ans; for(int i = 0; i < n; i++){ if(us[i]) { ans.emplace_back(sigma[i].second); res += sigma[i].first; } } if(res > u || res < l) return vector<int>(0); sort(ans.begin(), ans.end()); return ans; }

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

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...