제출 #603844

#제출 시각아이디문제언어결과실행 시간메모리
603844strange420Detecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms300 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; bool func(const ii& a, const ii& b) { return a.first < b.first; } std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<ii> asd; for (int i=0; i<w.size(); i++) asd.push_back(ii(w[i], 0)); sort(asd.begin(), asd.end(), func); vector<int> ans; int leftPt = 0, rightPt = 1, sum = w[0]; while(true) { if (sum > u) { sum -= w[leftPt]; leftPt++; if (leftPt > rightPt) break; } else if (sum < l) { if (rightPt == w.size()) break; sum += w[rightPt]; rightPt++; } else if (l <= sum && sum <=u) { for (int i=leftPt; i<rightPt; i++) ans.push_back(w[i]); break; } } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:11:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i=0; i<w.size(); i++)
      |                   ~^~~~~~~~~
molecules.cpp:23:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |             if (rightPt == w.size()) 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...