답안 #237137

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237137 2020-06-04T18:05:27 Z uacoder123 Detecting Molecules (IOI16_molecules) C++14
9 / 100
5 ms 512 KB
 #include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))

typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <ii,lli> iii;
typedef vector <lli> vi;

vector<int> find_subset(int l,int r,vector<int> arr1)
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
    lli n=arr1.size(),l1=0,r1=0;
    vector<ii> arr(n);
    for(lli i=0;i<n;++i)
    {
      arr[i].F=arr1[i];
      arr[i].S=i;
    }
    sort(all(arr));
    vector<ii> p(n+1);
    p[0]=mp(0,0); 
    for(lli i=1;i<=n;++i)
    {
      p[i]=mp(p[i-1].F+arr[i-1].F,i);
    }
    for(lli i=0;i<n;++i)
    {
      auto it = lower_bound(all(p),mp(p[i].F+l,0*1LL));
      if(it!=p.end()&&(*it).F-p[i].F>=l&&(*it).F-p[i].F<=r)
      {
        l1=p[i].S;
        r1=(*it).S;
        break;
      }
    }
    l1=l1-1;
    r1=r1-1;
    vector<int> v(r1-l1);
    for(lli i=l1+1;i<=r1;++i)
      v[i]=arr[i].S;
  return(v);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB OK (n = 1, answer = NO)
2 Correct 4 ms 384 KB OK (n = 1, answer = NO)
3 Correct 4 ms 384 KB OK (n = 1, answer = YES)
4 Correct 4 ms 384 KB OK (n = 2, answer = YES)
5 Correct 4 ms 384 KB OK (n = 2, answer = YES)
6 Correct 4 ms 384 KB OK (n = 3, answer = YES)
7 Correct 4 ms 384 KB OK (n = 3, answer = YES)
8 Correct 5 ms 384 KB OK (n = 3, answer = YES)
9 Correct 4 ms 384 KB OK (n = 3, answer = YES)
10 Correct 4 ms 384 KB OK (n = 3, answer = YES)
11 Correct 5 ms 384 KB OK (n = 3, answer = YES)
12 Correct 5 ms 384 KB OK (n = 3, answer = YES)
13 Correct 5 ms 384 KB OK (n = 3, answer = NO)
14 Correct 4 ms 384 KB OK (n = 3, answer = YES)
15 Correct 5 ms 384 KB OK (n = 3, answer = YES)
16 Correct 4 ms 384 KB OK (n = 3, answer = NO)
17 Correct 5 ms 384 KB OK (n = 3, answer = NO)
18 Correct 4 ms 384 KB OK (n = 100, answer = NO)
19 Correct 4 ms 384 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB OK (n = 1, answer = NO)
2 Correct 4 ms 384 KB OK (n = 1, answer = NO)
3 Correct 4 ms 384 KB OK (n = 1, answer = YES)
4 Correct 4 ms 384 KB OK (n = 2, answer = YES)
5 Correct 4 ms 384 KB OK (n = 2, answer = YES)
6 Correct 4 ms 384 KB OK (n = 3, answer = YES)
7 Correct 4 ms 384 KB OK (n = 3, answer = YES)
8 Correct 5 ms 384 KB OK (n = 3, answer = YES)
9 Correct 4 ms 384 KB OK (n = 3, answer = YES)
10 Correct 4 ms 384 KB OK (n = 3, answer = YES)
11 Correct 5 ms 384 KB OK (n = 3, answer = YES)
12 Correct 5 ms 384 KB OK (n = 3, answer = YES)
13 Correct 5 ms 384 KB OK (n = 3, answer = NO)
14 Correct 4 ms 384 KB OK (n = 3, answer = YES)
15 Correct 5 ms 384 KB OK (n = 3, answer = YES)
16 Correct 4 ms 384 KB OK (n = 3, answer = NO)
17 Correct 5 ms 384 KB OK (n = 3, answer = NO)
18 Correct 4 ms 384 KB OK (n = 100, answer = NO)
19 Correct 4 ms 384 KB OK (n = 100, answer = YES)
20 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB OK (n = 1, answer = NO)
2 Correct 4 ms 384 KB OK (n = 1, answer = NO)
3 Correct 4 ms 384 KB OK (n = 1, answer = YES)
4 Correct 4 ms 384 KB OK (n = 2, answer = YES)
5 Correct 4 ms 384 KB OK (n = 2, answer = YES)
6 Correct 4 ms 384 KB OK (n = 3, answer = YES)
7 Correct 4 ms 384 KB OK (n = 3, answer = YES)
8 Correct 5 ms 384 KB OK (n = 3, answer = YES)
9 Correct 4 ms 384 KB OK (n = 3, answer = YES)
10 Correct 4 ms 384 KB OK (n = 3, answer = YES)
11 Correct 5 ms 384 KB OK (n = 3, answer = YES)
12 Correct 5 ms 384 KB OK (n = 3, answer = YES)
13 Correct 5 ms 384 KB OK (n = 3, answer = NO)
14 Correct 4 ms 384 KB OK (n = 3, answer = YES)
15 Correct 5 ms 384 KB OK (n = 3, answer = YES)
16 Correct 4 ms 384 KB OK (n = 3, answer = NO)
17 Correct 5 ms 384 KB OK (n = 3, answer = NO)
18 Correct 4 ms 384 KB OK (n = 100, answer = NO)
19 Correct 4 ms 384 KB OK (n = 100, answer = YES)
20 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB OK (n = 1, answer = NO)
2 Correct 4 ms 384 KB OK (n = 1, answer = NO)
3 Correct 4 ms 384 KB OK (n = 1, answer = YES)
4 Correct 4 ms 384 KB OK (n = 2, answer = YES)
5 Correct 4 ms 384 KB OK (n = 2, answer = YES)
6 Correct 4 ms 384 KB OK (n = 3, answer = YES)
7 Correct 4 ms 384 KB OK (n = 3, answer = YES)
8 Correct 5 ms 384 KB OK (n = 3, answer = YES)
9 Correct 4 ms 384 KB OK (n = 3, answer = YES)
10 Correct 4 ms 384 KB OK (n = 3, answer = YES)
11 Correct 5 ms 384 KB OK (n = 3, answer = YES)
12 Correct 5 ms 384 KB OK (n = 3, answer = YES)
13 Correct 5 ms 384 KB OK (n = 3, answer = NO)
14 Correct 4 ms 384 KB OK (n = 3, answer = YES)
15 Correct 5 ms 384 KB OK (n = 3, answer = YES)
16 Correct 4 ms 384 KB OK (n = 3, answer = NO)
17 Correct 5 ms 384 KB OK (n = 3, answer = NO)
18 Correct 4 ms 384 KB OK (n = 100, answer = NO)
19 Correct 4 ms 384 KB OK (n = 100, answer = YES)
20 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB OK (n = 1, answer = NO)
2 Correct 4 ms 384 KB OK (n = 1, answer = NO)
3 Correct 4 ms 384 KB OK (n = 1, answer = YES)
4 Correct 4 ms 384 KB OK (n = 2, answer = YES)
5 Correct 4 ms 384 KB OK (n = 2, answer = YES)
6 Correct 4 ms 384 KB OK (n = 3, answer = YES)
7 Correct 4 ms 384 KB OK (n = 3, answer = YES)
8 Correct 5 ms 384 KB OK (n = 3, answer = YES)
9 Correct 4 ms 384 KB OK (n = 3, answer = YES)
10 Correct 4 ms 384 KB OK (n = 3, answer = YES)
11 Correct 5 ms 384 KB OK (n = 3, answer = YES)
12 Correct 5 ms 384 KB OK (n = 3, answer = YES)
13 Correct 5 ms 384 KB OK (n = 3, answer = NO)
14 Correct 4 ms 384 KB OK (n = 3, answer = YES)
15 Correct 5 ms 384 KB OK (n = 3, answer = YES)
16 Correct 4 ms 384 KB OK (n = 3, answer = NO)
17 Correct 5 ms 384 KB OK (n = 3, answer = NO)
18 Correct 4 ms 384 KB OK (n = 100, answer = NO)
19 Correct 4 ms 384 KB OK (n = 100, answer = YES)
20 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -