제출 #205372

#제출 시각아이디문제언어결과실행 시간메모리
205372okoDetecting Molecules (IOI16_molecules)C++14
100 / 100
72 ms6252 KiB
#include <cstdio> #include <vector> #include <cassert> #include<bits/stdc++.h> #include "molecules.h" using namespace std; long long a,b,sum; vector<pair<int,int> >v; vector<int> find_subset(int l, int u, std::vector<int> w) { for(int i=0;i<w.size();i++)v.push_back({w[i],i}); sort(v.begin(),v.end()); vector<int>ans; while(a<v.size()) { if(sum<l&&b<v.size()) { sum+=v[b].first; b++; } else if(u<sum||b==v.size()) { sum-=v[a].first; a++; } if(l<=sum&&sum<=u) { for(int i=a;i<b;i++)ans.push_back(v[i].second); return ans; } } }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<w.size();i++)v.push_back({w[i],i});
                 ~^~~~~~~~~
molecules.cpp:15:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(a<v.size())
           ~^~~~~~~~~
molecules.cpp:17:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(sum<l&&b<v.size())
                   ~^~~~~~~~~
molecules.cpp:22:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         else if(u<sum||b==v.size())
                        ~^~~~~~~~~~
molecules.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...