Submission #103921

# Submission time Handle Problem Language Result Execution time Memory
103921 2019-04-03T09:30:07 Z Hideo Detecting Molecules (IOI16_molecules) C++14
0 / 100
7 ms 4992 KB
#include "molecules.h"
#include <bits/stdc++.h>
//#include "grader.cpp"

using namespace std;

#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define vi vector < int >
#define pi pair < int, int >

const int N = 2e5 + 7;

int n, lf;
ll s;

vi ans, h, pos[N];

map < int, int > mp;

std::vector<int> find_subset(int l, int u, std::vector <int> w) {
    h = w;
    n = w.size();
    sort(h.begin(), h.end());
    for (int i = 0; i < n; i++)
        if (!i || h[i] != h[i - 1])
            mp[h[i]] = i;

    for (int i = 0; i < n; i++)
        pos[mp[w[i]]].pb(i + 1);

    for (int i = 0; i < n; i++){
        s += h[i];
        if (s > u){
            s -= h[lf];
            lf++;
        }
        if (s >= l){
            for (int j = lf; j <= i; j++){
                ans.pb(pos[mp[h[j]]].back());
                pos[mp[h[j]]].pop_back();
            }
            break;
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4992 KB OK (n = 1, answer = NO)
2 Correct 7 ms 4992 KB OK (n = 1, answer = NO)
3 Incorrect 6 ms 4992 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 4992 KB Integer 12 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4992 KB OK (n = 1, answer = NO)
2 Correct 7 ms 4992 KB OK (n = 1, answer = NO)
3 Incorrect 6 ms 4992 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4992 KB OK (n = 1, answer = NO)
2 Correct 7 ms 4992 KB OK (n = 1, answer = NO)
3 Incorrect 6 ms 4992 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4992 KB OK (n = 1, answer = NO)
2 Correct 7 ms 4992 KB OK (n = 1, answer = NO)
3 Incorrect 6 ms 4992 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4992 KB OK (n = 1, answer = NO)
2 Correct 7 ms 4992 KB OK (n = 1, answer = NO)
3 Incorrect 6 ms 4992 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -