제출 #875759

#제출 시각아이디문제언어결과실행 시간메모리
875759raul2008487Detecting Molecules (IOI16_molecules)C++17
0 / 100
47 ms65536 KiB
#include<bits/stdc++.h> #include "molecules.h" #define ll int #define all(v) v.begin(), v.end() #define pb push_back #define fi first #define se second #define vl vector<ll> using namespace std; bool check(ll cur, ll low, ll high){ return (cur <= high && cur >= low); } vector<int> find_subset(int l, int u, vector<int> w) { vl ans; vector<pair<ll,ll>> p; ll i, j, n = w.size(), left = 0, r = 1, sum = w[0]; for(i=0;i<n;i++){ p.pb({w[i], i}); } sort(all(p)); bool as = 0; while(r < n && left < r){ if(check(sum, l, u)){ for(i=left;i<=r;i++){ ans.pb(p[i-1].se); break; } } else if(sum > u){ left++; sum -= p[left-1].fi; } else{ r++; sum += p[r-1].fi; } } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:16:11: warning: unused variable 'j' [-Wunused-variable]
   16 |     ll i, j, n = w.size(), left = 0, r = 1, sum = w[0];
      |           ^
molecules.cpp:21:10: warning: unused variable 'as' [-Wunused-variable]
   21 |     bool as = 0;
      |          ^~
#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...