제출 #1001977

#제출 시각아이디문제언어결과실행 시간메모리
1001977ayankarimovaDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms436 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int>ans; map<ll, ll>mp; map<ll, vector<ll>>mp1; for(int i=0; i<w.size(); i++){ mp[w[i]]++; mp1[w[i]].push_back(i); } sort(w.begin(), w.end()); ll num=(l+w[0]-1)/w[0]; if(num<=mp[w[0]] && num*w[0]<=u && num*w[0]>=l){ for(auto j:mp1[w[0]]){ ans.push_back(j); if(ans.size()==num) break; } return ans; } if(num<=mp[w[w.size()-1]] && num*w[w.size()-1]<=u && num*w[w.size()-1]>=l){ for(auto j:mp1[w[w.size()-1]]){ ans.push_back(j); if(ans.size()==num) break; } return ans; } if(u-l>=1){ for(int i=1; i<=mp[w[0]]; i++){ ll cur=l-i*w[0]; ll cur1=(cur+w[w.size()-1]-1)/w[w.size()-1]; if(cur1<=mp[w[w.size()-1]] && i*w[0]+cur1*w[w.size()-1]>=l && i*w[0]+cur1*w[w.size()-1]<=u){ for(auto j:mp1[w[0]]){ ans.push_back(j); if(ans.size()==i) break; } for(auto j:mp1[w[w.size()-1]]){ ans.push_back(j); if(ans.size()==i+cur1) break; } return ans; } } } return ans; } /* {} [] 7 13 14 2 2 3 3 3 4 4 */

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i=0; i<w.size(); i++){
      |                  ~^~~~~~~~~
molecules.cpp:18:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   18 |             if(ans.size()==num) break;
      |                ~~~~~~~~~~^~~~~
molecules.cpp:25:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   25 |             if(ans.size()==num) break;
      |                ~~~~~~~~~~^~~~~
molecules.cpp:36:34: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |                     if(ans.size()==i) break;
      |                        ~~~~~~~~~~^~~
molecules.cpp:40:34: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   40 |                     if(ans.size()==i+cur1) break;
      |                        ~~~~~~~~~~^~~~~~~~
#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...