제출 #1001921

#제출 시각아이디문제언어결과실행 시간메모리
1001921ayankarimovaDetecting Molecules (IOI16_molecules)C++14
9 / 100
0 ms444 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); } //cout<<mp[6]<<endl; 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.count(i.first+1)>0 && 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()); cout<<1<<endl; return ans; } } if(mp.count(i.first-1)>0 && 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()); cout<<2<<endl; 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:19:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   19 |                 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:49:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   49 |                         if(ans.size()==i.second) break;
      |                            ~~~~~~~~~~^~~~~~~~~~
molecules.cpp:53:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   53 |                         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...