답안 #1065073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1065073 2024-08-18T22:18:30 Z MrPavlito Detecting Molecules (IOI16_molecules) C++17
10 / 100
1000 ms 432 KB
#include "molecules.h"
#include <bits/stdc++.h>
//#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
//#define endl "\n"
#define pii pair<int,int>

using namespace std;

const int MAXN = 1e5+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    int n = w.size();
    vector<pii> niz(n);
    for(int i=0; i<n; i++)niz[i] = mp(w[i],i);
    sort(all(niz));
    int pl = 0;
    int pr = 0;
    long long trsum = niz[0].fi;
    vector<int> resenje;
    while(pr< n)
    {
        if(trsum <= u && trsum>=l)
        {
            for(int i=pl; i<=pr; i++)resenje.pb(niz[i].sc);
            return resenje;
        }
        else if(trsum > u)
        {
            while(pl < pr && trsum > u)
            {
                trsum-= niz[pl++].fi;
                 if(trsum <= u && trsum>=l)
                {
                    for(int i=pl; i<=pr; i++)resenje.pb(niz[i].sc);
                    return resenje;
                }
            }
        }
        else
        {
            pr++;
            if(pr != n)trsum+= niz[pr].fi;
        }
    }
    return resenje;


}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Execution timed out 1087 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB OK (n = 12, answer = YES)
2 Correct 1 ms 348 KB OK (n = 12, answer = YES)
3 Correct 0 ms 348 KB OK (n = 12, answer = NO)
4 Correct 0 ms 348 KB OK (n = 12, answer = NO)
5 Correct 1 ms 348 KB OK (n = 12, answer = YES)
6 Correct 1 ms 348 KB OK (n = 12, answer = YES)
7 Correct 0 ms 432 KB OK (n = 12, answer = YES)
8 Correct 0 ms 348 KB OK (n = 12, answer = YES)
9 Correct 0 ms 348 KB OK (n = 6, answer = YES)
10 Correct 0 ms 348 KB OK (n = 12, answer = YES)
11 Correct 1 ms 348 KB OK (n = 100, answer = NO)
12 Correct 0 ms 348 KB OK (n = 100, answer = YES)
13 Correct 0 ms 348 KB OK (n = 100, answer = NO)
14 Correct 0 ms 348 KB OK (n = 100, answer = YES)
15 Correct 0 ms 348 KB OK (n = 100, answer = YES)
16 Correct 0 ms 348 KB OK (n = 100, answer = YES)
17 Correct 0 ms 348 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Execution timed out 1087 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Execution timed out 1087 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Execution timed out 1087 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Execution timed out 1087 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -