제출 #962693

#제출 시각아이디문제언어결과실행 시간메모리
962693hirayuu_ojDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms348 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) #define all(x) x.begin(),x.end() using ll=long long; void out(int x){ cerr<<x; } void out(ll x){ cerr<<x; } template<typename F,typename S> void out(pair<F,S> x){ cerr<<"("; out(x.first); cerr<<", "; out(x.second); cerr<<")"; } template<typename S> void out(S x){ cerr<<"["; for(auto i:x){ out(i); cerr<<", "; } cerr<<"]"; } template<typename H> void DBG(H x){ cerr<<"DBG:"; out(x); cerr<<"\n"; } std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n=w.size(); vector<ll> cum(w.size()+1,0); vector<pair<ll,ll>> wi(w.size()); rep(i,w.size()){ wi[i]={w[i],i}; } sort(all(wi)); rep(i,n){ cum[i+1]=cum[i]+wi[i].first; } rep(i,n+1){ if(cum[i]>u)continue; if(cum[n]-cum[n-i]<l)continue; rep(j,i+1){ if(l<=cum[j]+cum[n]-cum[n-(i-j)]&&cum[j]+cum[n]-cum[n-(i-j)]<=u){ vector<int> ans(0); rep(k,j){ ans.push_back(wi[k].second+1); } rep(k,i-j){ ans.push_back(wi[n-k-1].second+1); } return ans; } } } return std::vector<int>(0); }

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

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