제출 #434904

#제출 시각아이디문제언어결과실행 시간메모리
434904ToroTNDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms216 KiB
#include<bits/stdc++.h> using namespace std; #include "molecules.h" int it=-1,sum=0,type; vector<int> emptyvec; vector<pair<int,int> > v; std::vector<int> find_subset(int l, int u, std::vector<int> w) { for(int i=0;i<w.size();i++) { v.push_back(make_pair(w[i],i)); } for(int i=0;i<v.size();i++) { sum+=v[i].first; if(sum>=l) { if(sum<=u) { for(int j=0;j<=i;j++) { emptyvec.push_back(v[j].second); } return emptyvec; } it=i; break; } } if(it==-1) { return emptyvec; } for(int i=1;i<v.size();i++) { type=-1; sum-=v[i-1].first; if(sum>=l) { if(sum<=u) { for(int j=i-1;j<=it;j++) { emptyvec.push_back(v[j].second); } return emptyvec; } continue; } for(int j=it+1;j<v.size();j++) { sum+=v[j].first; if(sum>=l) { if(sum<=u) { for(int k=i;i<=j;i++) { emptyvec.push_back(v[k].second); } return emptyvec; } type=0; break; } } if(type==-1) { return emptyvec; } } return emptyvec; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:18: 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:12:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
molecules.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i=1;i<v.size();i++)
      |                 ~^~~~~~~~~
molecules.cpp:49:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         for(int j=it+1;j<v.size();j++)
      |                        ~^~~~~~~~~
#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...