답안 #156640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
156640 2019-10-06T17:36:24 Z a_player Detecting Molecules (IOI16_molecules) C++14
0 / 100
101 ms 65540 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
pair<ll,int> p[200001];
ll pr[200001];
ll su[200001];
vector<int> find_subset(int l,int u,vector<int> w){
	
	int N=w.size();
	for(int i=0;i<N;i++){
		p[i].f=(ll)w[i];
		p[i].s=i;
		}
		sort(p,p+N);
		vector<int> sol;
		int j=N;
		ll s=0;
		ll s1=0;
		for(int i=0;i<N;i++){
			s+=p[i].f;
			s1+=p[N-i-1].f;
			pr[i]=s;
			su[N-i-1]=s1;
			if(s1>(ll)u&&j==N)j=N-i;
			}
		if(su[j]>=(ll)l&&su[j]<=(ll)u){
			for(int i=N-1;i>=j;i--)sol.push_back(p[i].s);
			return sol;
			}
		for(int i=0;i<N;i++){
			for(;j<N&&su[j]+pr[i]>(ll)u;j++){}
			if(pr[i]+su[j]>=(ll)l&&su[j]+pr[i]<=(ll)u){
				for(int k=N-1;k>=j;k--)sol.push_back(p[k].s);
				for(int k=0;k<=i;i++)sol.push_back(p[k].s);
			    return sol;
				}
			}
	return sol;
	}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Runtime error 101 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 99 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Runtime error 101 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Runtime error 101 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Runtime error 101 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Runtime error 101 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -