제출 #373515

#제출 시각아이디문제언어결과실행 시간메모리
373515flappybirdDetecting Molecules (IOI16_molecules)C++14
69 / 100
56 ms4972 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef int ll; #define MAX 505050 #define pb push_back ll arr[MAX]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<pair<ll, ll>> vv; vv.resize(w.size() + 1); ll i; vv[0].second = -1; for (i = 0; i < w.size(); i++) { vv[i + 1] = { w[i], i }; } sort(vv.begin(), vv.end()); for (i = 1; i < w.size(); i++) { vv[i + 1].first += vv[i].first; } ll low, high; low = 1, high = 1; vector<ll> ret; bool c = false; while (1) { if (high > w.size()) break; ll x = vv[high].first - vv[low - 1].first; if (l <= x && x <= u) { for (i = low; i <= high; i++) ret.push_back(vv[i].second); c = true; break; } if (x < l) high++; if (x > u) low++; } return ret; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:13:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  for (i = 0; i < w.size(); i++) {
      |              ~~^~~~~~~~~~
molecules.cpp:17:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for (i = 1; i < w.size(); i++) {
      |              ~~^~~~~~~~~~
molecules.cpp:25:12: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   if (high > w.size()) break;
      |       ~~~~~^~~~~~~~~~
molecules.cpp:23:7: warning: variable 'c' set but not used [-Wunused-but-set-variable]
   23 |  bool c = false;
      |       ^
#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...