제출 #774593

#제출 시각아이디문제언어결과실행 시간메모리
774593JMsDetecting Molecules (IOI16_molecules)C++17
0 / 100
2 ms1748 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { unsigned const long long tam = 200005; long long v[tam], aux, ph, pl, s; vector <int> result; for( long long i=0; i<w.size(); i++){ v[i]=i; } for( long long i=0; i<w.size()-1; i++){ for( long long j=i+1; j<w.size(); j++){ if(w[i]>w[j]){ aux=w[j]; w[j]=w[i]; w[i]=aux; aux=v[j]; v[j]=v[i]; v[i]=aux; } } } pl=0; ph=0; s=w[0]; while(1){ cout<<pl<<" "<<ph<<" "<<s<<endl; if(s<l && ph<w.size()-1){ ph++; s+=w[ph]; } else if(s>u && pl<ph){ s-=w[pl]; pl++; } else if( ph==w.size()-1 && (s>u || s<l)){ return vector<int>(); break; } else{ for( long long i=pl; i<=ph; i++){ cout<<v[i]<<" "; result.push_back(v[i]); } cout<<endl; break; } } return result; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:10:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |         for( long long i=0; i<w.size(); i++){
      |                             ~^~~~~~~~~
molecules.cpp:13:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |         for( long long i=0; i<w.size()-1; i++){
      |                             ~^~~~~~~~~~~
molecules.cpp:14:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |             for( long long j=i+1; j<w.size(); j++){
      |                                   ~^~~~~~~~~
molecules.cpp:30:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if(s<l && ph<w.size()-1){
      |                       ~~^~~~~~~~~~~
molecules.cpp:38:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             else if( ph==w.size()-1 && (s>u || s<l)){
      |                      ~~^~~~~~~~~~~~
#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...