제출 #448384

#제출 시각아이디문제언어결과실행 시간메모리
448384tredsused70Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms1740 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") using namespace std; #define accelerator ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define fi first #define sc second #define pb push_back typedef long long ll; typedef unsigned long long ull; typedef long double ld; const int nmax=100011,mod=1e9+7,inf=2000010000; const ll infll=4000000000000000000; vector<int> find_subset(int l,int u,vector<int> mas_) { int used[100100]={0},m=0,pos,ans[100100]={0}; vector<int> ans_; int n=mas_.size(); array<int,2> mas[100100]; ll sum=0; for(int i=0;i<n;i++) mas[i]={mas_[i],i+1}; sort(mas,mas+n); for(int i=0;i<n;i++) { sum+=mas[i][0]; if(sum>u) { sum-=mas[i][0]; break; } used[mas[i][1]]=1; ans[m]=mas[i][1]; m++; if(sum>=l) { for(int i=0;i<m;i++) ans_.push_back(ans[i]); return ans_; } } for(int i=m-1;i>=0;i--) { if(used[mas[n-m+i][1]]) continue; used[mas[i][1]]=0; used[mas[n-m+i][1]]=1; sum-=mas[i][0]; sum+=mas[n-m+i][0]; ans[i]=mas[n-m+i][1]; if(sum>=l) { for(int i=0;i<m;i++) ans_.push_back(ans[i]); return ans_; } } return {0}; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:20:30: warning: unused variable 'pos' [-Wunused-variable]
   20 |     int used[100100]={0},m=0,pos,ans[100100]={0};
      |                              ^~~
#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...