제출 #599634

#제출 시각아이디문제언어결과실행 시간메모리
599634SummersDetecting Molecules (IOI16_molecules)C++14
0 / 100
6 ms308 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; struct str { long long num,ind; }a[1000000]; bool cmp(str a1, str a2) { return a1.num<a2.num; } std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int>v; long long le=0, i, ri=0, n=w.size(), sum=0; for(i=0;i<n;i++) { a[i].num=w[i]; a[i].ind=i+1; } sort(a,a+n,cmp); sum+=a[0].num; if(sum>=l && sum<=u) { v.push_back(a[0].ind); return v; } while(ri<=n-1) { ri++; sum+=a[ri].num; if(sum>=l && sum<=u) { for(i=le;i<=ri;i++)v.push_back(a[i].ind); return v; } while(sum>=u) { sum-=a[le].num; le++; } if(sum>=l && sum<=u) { for(i=le;i<=ri;i++)v.push_back(a[i].ind); return v; } } }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:57:1: warning: control reaches end of non-void function [-Wreturn-type]
   57 | }
      | ^
#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...