제출 #370484

#제출 시각아이디문제언어결과실행 시간메모리
370484FystyDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms512 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<n;i++) #define F first #define S second #define pb push_back vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ans; vector<pll> a; rep(i,w.size()) a.pb({w[i],i}); sort(a.begin(),a.end()); int n=w.size(),sum=0; for(int i=n-1;i>=0;i--) { sum+=a[i].F; } ll tot=0,cur=0; rep(i,n+1) { //cout<<i<<" "<<tot<<" "; while(tot+sum>u&&cur<=n-1) sum-=a[cur].F,cur++; //cout<<cur<<" "<<sum<<"\n"; if(tot+sum>=l&&tot+sum<=u) { rep(j,i) ans.pb(a[j].S); for(int j=cur;j<n;j++) ans.pb(a[j].S); break; } if(i==n) break; tot+=a[i].F; } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:5:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(i,n) for(int i=0;i<n;i++)
......
   14 |     rep(i,w.size()) a.pb({w[i],i});
      |         ~~~~~~~~~~             
molecules.cpp:14:5: note: in expansion of macro 'rep'
   14 |     rep(i,w.size()) a.pb({w[i],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...