제출 #519768

#제출 시각아이디문제언어결과실행 시간메모리
519768yhlasDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms256 KiB
#include "bits/stdc++.h" using namespace std; int n,b,c,p[200005],e,l,r,md,jog,k; vector<int> a,d; pair <int, int> u[200005]; vector<int> find_subset(int x, int y, vector<int> v){ for (int i = 0; i < v.size(); i++) u[i].first = v[i], u[i].second = i; sort(v.begin(), v.end()); p[0] = v[0]; for (int i = 1; i < v.size(); i++) p[i] = p[i - 1] + v[i]; for (int i = 0; i < v.size(); i++){ a.push_back(u[i].second); if (x <= p[i] and p[i] <= y) return a; } a.clear(); for (int i = 1; i < v.size(); i++){ l = i,r = v.size() - 1,md,jog = -1; while (l <= r){ md = (l + r) / 2; if (y < p[md] - p[i - 1]) r = md - 1; else if (x > p[md] - p[i - 1]) l = md + 1; else{ e = i; jog = md; break; } } if (jog != -1) break; } for (int i = e; i <= jog; i++) a.push_back(u[i].second); return a; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |  for (int i = 0; i < v.size(); i++) u[i].first = v[i], u[i].second = i;
      |                  ~~^~~~~~~~~~
molecules.cpp:10:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for (int i = 1; i < v.size(); i++) p[i] = p[i - 1] + v[i];
      |                  ~~^~~~~~~~~~
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 < v.size(); i++){
      |                  ~~^~~~~~~~~~
molecules.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for (int i = 1; i < v.size(); i++){
      |                  ~~^~~~~~~~~~
molecules.cpp:17:36: warning: right operand of comma operator has no effect [-Wunused-value]
   17 |   l = i,r = v.size() - 1,md,jog = -1;
      |                                    ^
#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...