제출 #1001855

#제출 시각아이디문제언어결과실행 시간메모리
1001855ayankarimovaDetecting Molecules (IOI16_molecules)C++14
0 / 100
306 ms65536 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); } for(auto i:mp){ ll num=(l+i.first-1)/i.first; if(num<=i.second && num*i.first<=u && num*i.first>=l){ for(auto j:mp1[i.first]){ ans.push_back(j); if(ans.size()==num) break; } //cout<<1<<endl; sort(ans.begin(), ans.end()); return ans; } if(mp[i.first+1] && u-l==1){ ll cur=l-i.second*i.first; ll num1=(cur+(i.first+1)-1)/(i.first+1); if(num1<=mp[i.first+1] && i.second*i.first+num1*(i.first+1)<=u && i.second*i.first+num1*(i.first+1)>=l){ for(auto j:mp1[i.first]){ ans.push_back(j); if(ans.size()==i.second) break; } for(auto j:mp1[i.first+1]){ ans.push_back(j); if(ans.size()==i.second+num1) break; } //cout<<2<<endl; sort(ans.begin(), ans.end()); return ans; } } if(mp[i.first-1] && u-l==1){ ll cur=l-i.second*i.first; ll num1=(cur+(i.first-1)-1)/(i.first-1); if(num1<=mp[i.first-1] && i.second*i.first+num1*(i.first-1)<=u && i.second*i.first+num1*(i.first-1)>=l){ for(auto j:mp1[i.first]){ ans.push_back(j); if(ans.size()==i.second) break; } for(auto j:mp1[i.first-1]){ ans.push_back(j); if(ans.size()==i.second+num1) break; } //cout<<2<<endl; sort(ans.begin(), ans.end()); 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:30: 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:31:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   31 |                         if(ans.size()==i.second) break;
      |                            ~~~~~~~~~~^~~~~~~~~~
molecules.cpp:35:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   35 |                         if(ans.size()==i.second+num1) break;
      |                            ~~~~~~~~~~^~~~~~~~~~~~~~~
molecules.cpp:48:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   48 |                         if(ans.size()==i.second) break;
      |                            ~~~~~~~~~~^~~~~~~~~~
molecules.cpp:52:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   52 |                         if(ans.size()==i.second+num1) 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...