이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "molecules.h"
#define pi 3.141592653589793238
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
vector<int> find_subset(int l, int u, vector<int> w){
int i, st = 0, en = -1;
int n = w.size();
int sum = 0;
vector<int> idx;
for(i = 0; i < n; i++){
idx.pb(i);
}
sort(idx.begin(), idx.end(), [&](int a, int b){
return w[a] < w[b];
});
int ansl = -1, ansr = -1;
for(i = 0; i < n; i++){
while(sum < l){
en++;
if(en == n){
break;
}
sum += w[en];
}
if(sum >= l && sum <= u){
ansl = st, ansr = en;
break;
}
while(sum > u){
if(st == n){
break;
}
sum -= w[st];
st++;
}
if(sum >= l && sum <= u){
ansl = st, ansr = en;
break;
}
}
if(ansl == -1){
return {};
}
w.clear();
vector<int> ans;
for(i = ansl; i <= ansr; i++){
ans.pb(idx[i]);
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
molecules.cpp:5: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
5 | #pragma GCC optimization ("O3")
|
molecules.cpp:6: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
6 | #pragma GCC optimization ("unroll-loops")
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |