답안 #156583

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
156583 2019-10-06T14:33:09 Z InfiniteJest Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 376 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

typedef long long ll;

int n;
int ls,rs;
vector<int> v;
int res[100001];
pair<int,int> p[100001];

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
  int s=-1;
  int d=n-1;
  int sum=0;
  bool flag=0;
  vector<int> sol;
  for(int i=0;i<n;i++){
    p[i].fi=w[i];
    p[i].se=i;
  }
  sort(p,p+n);
  while(s<n){
    if(sum>u)break;
    while((sum<l||sum>u)&&d>s){
      sum+=p[d].fi;
      d--;
    }
    d++;
    if(sum>=l&&sum<=u){
      flag=1;
      break;
    }
    sum-=p[d].fi;
    s++;
    sum+=p[s].fi;

  }
  if(flag){
    for(int i=0;i<=s;i++)sol.pb(p[i].se);
    for(int i=n-1;i>=d;i--)sol.pb(p[i].se);
    return sol;
  }
  return vector<int>();

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -