답안 #186968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
186968 2020-01-12T11:51:43 Z PedroBigMan Detecting Molecules (IOI16_molecules) C++14
9 / 100
4 ms 504 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include "molecules.h"
using namespace std;
typedef int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define INF 100000000000000000LL
ll insig;
#define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);}
void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}

vector<ll> find_subset(ll l,ll u, vector<ll> wee)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll N=wee.size(); vector<pl> we; 
    ll curin;
    REP(i,0,N) {we.pb(mp(wee[i],i));}
    sort(we.begin(),we.end()); vector<ll> w; REP(i,0,N) {w.pb(we[i].ff);}
    vector<bool> cur; REP(i,0,N) {cur.pb(false);}
    vector<pl> sums; ll losum=0; ll hisum=0;
    REP(i,0,N)
    {
        losum+=w[i]; hisum+=w[N-i-1];
        sums.pb(mp(losum,hisum));
    }
    vector<ll> ans;
    REP(k,1,N+1)
    {
        if(sums[k-1].ff<=u && sums[k-1].ss>=l)
        {
            ll curs=0;
            REP(i,0,k) {cur[i]=true; curs+=w[i];}
            ll ind=0;
            while(curs<l)
            {
                cur[ind]=false; cur[N-1-ind]=true;
                curs-=w[ind]; curs+=w[N-1-ind];
            }
            REP(i,0,N) {if(cur[i]) {ans.pb(we[i].ss);}}
            return ans;
        }
    }
    return ans;
}

Compilation message

molecules.cpp: In function 'void Out(std::vector<int>)':
molecules.cpp:15:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
molecules.cpp:24:29:
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                             ~~~~~~~~~~~~
molecules.cpp:24:25: note: in expansion of macro 'REP'
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                         ^~~
molecules.cpp: In function 'std::vector<int> find_subset(ll, ll, std::vector<int>)':
molecules.cpp:31:8: warning: unused variable 'curin' [-Wunused-variable]
     ll curin;
        ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 504 KB OK (n = 2, answer = YES)
5 Correct 3 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 360 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 380 KB OK (n = 3, answer = YES)
15 Correct 2 ms 372 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 3 ms 348 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB sum of weights should be in [302..304] but it is 301
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 504 KB OK (n = 2, answer = YES)
5 Correct 3 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 360 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 380 KB OK (n = 3, answer = YES)
15 Correct 2 ms 372 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 3 ms 348 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Incorrect 2 ms 376 KB sum of weights should be in [302..304] but it is 301
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 504 KB OK (n = 2, answer = YES)
5 Correct 3 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 360 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 380 KB OK (n = 3, answer = YES)
15 Correct 2 ms 372 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 3 ms 348 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Incorrect 2 ms 376 KB sum of weights should be in [302..304] but it is 301
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 504 KB OK (n = 2, answer = YES)
5 Correct 3 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 360 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 380 KB OK (n = 3, answer = YES)
15 Correct 2 ms 372 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 3 ms 348 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Incorrect 2 ms 376 KB sum of weights should be in [302..304] but it is 301
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 504 KB OK (n = 2, answer = YES)
5 Correct 3 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 376 KB OK (n = 3, answer = YES)
7 Correct 2 ms 376 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Correct 2 ms 360 KB OK (n = 3, answer = YES)
10 Correct 2 ms 376 KB OK (n = 3, answer = YES)
11 Correct 2 ms 376 KB OK (n = 3, answer = YES)
12 Correct 2 ms 376 KB OK (n = 3, answer = YES)
13 Correct 2 ms 376 KB OK (n = 3, answer = NO)
14 Correct 2 ms 380 KB OK (n = 3, answer = YES)
15 Correct 2 ms 372 KB OK (n = 3, answer = YES)
16 Correct 2 ms 376 KB OK (n = 3, answer = NO)
17 Correct 2 ms 376 KB OK (n = 3, answer = NO)
18 Correct 3 ms 348 KB OK (n = 100, answer = NO)
19 Correct 2 ms 376 KB OK (n = 100, answer = YES)
20 Incorrect 2 ms 376 KB sum of weights should be in [302..304] but it is 301
21 Halted 0 ms 0 KB -