제출 #1029523

#제출 시각아이디문제언어결과실행 시간메모리
1029523nisanduuDetecting Molecules (IOI16_molecules)C++14
0 / 100
0 ms348 KiB
#include "molecules.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int> pref = w; vector<int> ans; for(ll i=1;i<w.size();i++){ pref[i]=pref[i-1]+pref[i]; } int n = w.size(); for(ll i=0;i<w.size();i++){ ll target = i != 0 ? pref[i-1] : 0; target += l; ll ub = (target-l) + u; ll left = i,right = n-1; ll ind = i; while(left<=right){ ll mid = left + (right-left)/2; if(pref[mid]<target){ left = mid+1; }else if(pref[mid]>ub){ right = mid-1; }else{ ind = mid; right = mid-1; } } if(pref[ind]>=target&&pref[ind]<=ub){ for(ll j=i;j<=ind;j++){ ans.push_back(j+1); } return ans; } } return ans; }

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

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