제출 #819257

#제출 시각아이디문제언어결과실행 시간메모리
819257LeVanThucDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms300 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define p(x,y) pair<ll,ll>(x,y) #define BIT(i,x) ((x>>i)&1) #define MASK(x) (1<<x) #define ld long double #define __builtin_popcount __builtin_popcountll #define pll pair<ll,ll> template<class T1,class T2> bool maximize(T1 &x,const T2 &y) { if(x<y) { x=y; return 1; } return 0; } template<class T1,class T2> bool minimize(T1 &x,const T2 &y) { if(x>y) { x=y; return 1; } return 0; } void online() { std::ios_base::sync_with_stdio(0); cin.tie(0); //#ifndef ONLINE_JUDGE // freopen("input.inp", "r", stdin); // freopen("output.out","w", stdout); //#else //#endif } const ll M=1e9,N=1e5+10; vector<int> find_subset(int l,int r,vector<int> w) { vector<pll> vt; for(int i=0;i<w.size();i++) { vt.emplace_back(w[i],i); } sort(vt.begin(),vt.end()); ll sum=0; ll j=0; vector<int> res; for(int i=0;i<w.size();i++) { sum+=vt[i].fi; while(sum>r&&j<i) { sum-=vt[j].fi; j++; } if(sum>=l&&sum<=r) { for(int k=j;k<=i;k++) res.push_back(vt[i].se); return res; } } return res; }

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

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