Submission #851569

# Submission time Handle Problem Language Result Execution time Memory
851569 2023-09-20T06:58:23 Z askow Detecting Molecules (IOI16_molecules) C++14
9 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    int n=w.size();
    set<int>s;
    for(int i=0;i<n;i++)s.insert(w[i]);
    if(n<=100&&s.size()==1){
        int pref[n];
        pref[0]=w[0];
        for(int i=1;i<n;i++)pref[i]=pref[i-1]+w[i];
        vector<int>ans;
        for(int i=0;i<n;i++){
            for(int j=i;j<n;j++){
                int C=-1;
                if(i==0)C=pref[j];
                else C=pref[j]-pref[i-1];
                if(C>=l&&C<=u){
                    for(int k=i;k<=j;k++)ans.push_back(k);
                    return ans;
                }
            }
        }
        return {};
    }
}/*
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,u,v;
    cin>>n>>u>>v;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(auto it:find_subset(u,v,a))cout<<it<<" ";
}*/

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:6:13: warning: control reaches end of non-void function [-Wreturn-type]
    6 |     set<int>s;
      |             ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Correct 1 ms 544 KB OK (n = 1, answer = YES)
4 Correct 0 ms 344 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 1 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 344 KB OK (n = 3, answer = YES)
8 Correct 0 ms 344 KB OK (n = 3, answer = YES)
9 Correct 1 ms 344 KB OK (n = 3, answer = YES)
10 Correct 1 ms 344 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 1 ms 344 KB OK (n = 3, answer = NO)
14 Correct 0 ms 344 KB OK (n = 3, answer = YES)
15 Correct 0 ms 344 KB OK (n = 3, answer = YES)
16 Correct 0 ms 600 KB OK (n = 3, answer = NO)
17 Correct 1 ms 344 KB OK (n = 3, answer = NO)
18 Correct 0 ms 344 KB OK (n = 100, answer = NO)
19 Correct 1 ms 344 KB OK (n = 100, answer = YES)
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Correct 1 ms 544 KB OK (n = 1, answer = YES)
4 Correct 0 ms 344 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 1 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 344 KB OK (n = 3, answer = YES)
8 Correct 0 ms 344 KB OK (n = 3, answer = YES)
9 Correct 1 ms 344 KB OK (n = 3, answer = YES)
10 Correct 1 ms 344 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 1 ms 344 KB OK (n = 3, answer = NO)
14 Correct 0 ms 344 KB OK (n = 3, answer = YES)
15 Correct 0 ms 344 KB OK (n = 3, answer = YES)
16 Correct 0 ms 600 KB OK (n = 3, answer = NO)
17 Correct 1 ms 344 KB OK (n = 3, answer = NO)
18 Correct 0 ms 344 KB OK (n = 100, answer = NO)
19 Correct 1 ms 344 KB OK (n = 100, answer = YES)
20 Runtime error 1 ms 344 KB Execution killed with signal 11
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Correct 1 ms 544 KB OK (n = 1, answer = YES)
4 Correct 0 ms 344 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 1 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 344 KB OK (n = 3, answer = YES)
8 Correct 0 ms 344 KB OK (n = 3, answer = YES)
9 Correct 1 ms 344 KB OK (n = 3, answer = YES)
10 Correct 1 ms 344 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 1 ms 344 KB OK (n = 3, answer = NO)
14 Correct 0 ms 344 KB OK (n = 3, answer = YES)
15 Correct 0 ms 344 KB OK (n = 3, answer = YES)
16 Correct 0 ms 600 KB OK (n = 3, answer = NO)
17 Correct 1 ms 344 KB OK (n = 3, answer = NO)
18 Correct 0 ms 344 KB OK (n = 100, answer = NO)
19 Correct 1 ms 344 KB OK (n = 100, answer = YES)
20 Runtime error 1 ms 344 KB Execution killed with signal 11
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Correct 1 ms 544 KB OK (n = 1, answer = YES)
4 Correct 0 ms 344 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 1 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 344 KB OK (n = 3, answer = YES)
8 Correct 0 ms 344 KB OK (n = 3, answer = YES)
9 Correct 1 ms 344 KB OK (n = 3, answer = YES)
10 Correct 1 ms 344 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 1 ms 344 KB OK (n = 3, answer = NO)
14 Correct 0 ms 344 KB OK (n = 3, answer = YES)
15 Correct 0 ms 344 KB OK (n = 3, answer = YES)
16 Correct 0 ms 600 KB OK (n = 3, answer = NO)
17 Correct 1 ms 344 KB OK (n = 3, answer = NO)
18 Correct 0 ms 344 KB OK (n = 100, answer = NO)
19 Correct 1 ms 344 KB OK (n = 100, answer = YES)
20 Runtime error 1 ms 344 KB Execution killed with signal 11
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Correct 1 ms 544 KB OK (n = 1, answer = YES)
4 Correct 0 ms 344 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 1 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 344 KB OK (n = 3, answer = YES)
8 Correct 0 ms 344 KB OK (n = 3, answer = YES)
9 Correct 1 ms 344 KB OK (n = 3, answer = YES)
10 Correct 1 ms 344 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 1 ms 344 KB OK (n = 3, answer = NO)
14 Correct 0 ms 344 KB OK (n = 3, answer = YES)
15 Correct 0 ms 344 KB OK (n = 3, answer = YES)
16 Correct 0 ms 600 KB OK (n = 3, answer = NO)
17 Correct 1 ms 344 KB OK (n = 3, answer = NO)
18 Correct 0 ms 344 KB OK (n = 100, answer = NO)
19 Correct 1 ms 344 KB OK (n = 100, answer = YES)
20 Runtime error 1 ms 344 KB Execution killed with signal 11
21 Halted 0 ms 0 KB -