제출 #976142

#제출 시각아이디문제언어결과실행 시간메모리
976142batsukh2006Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms596 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; #define ff first #define ss second vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int,int> > v; for(int i=0; i<w.size(); i++){ v.push_back({w[i],i}); } int i=0; queue<int> q; long long sum=0; sort(v.begin(),v.end()); while(sum+v[i].ff<=l&&i<v.size()){ sum+=v[i].ff; q.push(v[i++].ss); } if(i>0){ while(sum<=l&&i<v.size()){ sum+=v[i].ff-v[q.front()].ff; q.push(v[i++].ss); q.pop(); } } vector<int> ans; if(i==0){ sum+=v[0].ff; q.push(v[0].ss); } if(sum>=l&&sum<=u){ while(!q.empty()){ ans.push_back(q.front()); q.pop(); } } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for(int i=0; i<w.size(); i++){
      |               ~^~~~~~~~~
molecules.cpp:15:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     while(sum+v[i].ff<=l&&i<v.size()){
      |                           ~^~~~~~~~~
molecules.cpp:20:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |      while(sum<=l&&i<v.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...