이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
int Segtree[4*109];
int Q(int l, int r, int pos, int ql, int qr){
if(ql > r || qr < l){
return 0;
}
if(l >= ql && r <= qr){
return Segtree[pos];
}
int mid = (l+r)/2;
return Q(l,mid, pos*2, ql, qr) + Q(mid+1, r, pos*2+1, ql, qr);
}
void B(vector<int> w, int l, int r, int pos){
if(l == r){
Segtree[pos] = w[l-1];
return;
}
int mid = (l+r)/2;
B(w, l, mid, pos*2);
B(w, mid+1, r, pos*2+1);
Segtree[pos] = Segtree[pos*2+1]+Segtree[pos*2];
}
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
B(w, 1, n, 1);
//for(int i = 1; i < 8; i++) cout << Segtree[i] << ' ';
//cout << endl;
for(int i = 0; i < n; i++){
for(int j = i; j < n; j++){
int a = Q(1,n, 1, i+1,j+1);
if(a <= u && a>=l){
//cout << a << endl;
vector<int> v(0);
for(int k = i; k <= j; k++){
v.push_back(k);
}
return v;
}
}
}
vector<int> v(0);
return v;
}
/*int main(){
int a, b, c;
cin >> a >> b >> c;
vector<int> v(0);
for(int i = 0; i < a; i++){
int d;
cin >> d;
v.push_back(d);
}
v = find_subset(a,b,c,v);
cout << v.size() << endl;
for(int i = 0; i < v.size(); i++){
cout << v[i] << ' ';
}
cout << endl;
}*/
# | 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... |