Submission #1107055

# Submission time Handle Problem Language Result Execution time Memory
1107055 2024-10-31T13:17:22 Z Aviansh Teams (IOI15_teams) C++17
0 / 100
4000 ms 10020 KB
#include "teams.h"
#include <bits/stdc++.h>

using namespace std;
int nums[100005];
int nume[100005];
int nr;

void init(int n, int a[], int b[]) {
    nr=n;
    for(int i = 0;i<100005;i++){
        nums[i]=0;
        nume[i]=0;
    }
    for(int i = 0;i<n;i++){
        nums[a[i]]++;
        nume[b[i]]++;
    }
}

int can(int m, int k[]) {
    int active=0;
    int knum[100005];
    fill(knum,knum+100005,0);
    long long sm = 0;
    for(int i = 0;i<m;i++){
        knum[k[i]]++;
        sm+=k[i];
    }
    if(sm>nr){
        return 0;
    }
    int skip=0;
    for(int i = 0;i<100005;i++){
        active+=nums[i];
        active-=knum[i]*i;
        if(active<0){
            return 0;
        }
        skip+=knum[i]*i;
        if(skip>=nume[i]){
            skip-=nume[i];
        }
        else{
            active-=(nume[i]-skip);
            if(active<0){
                return 0;
            }
            skip=0;
        }
    }
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1360 KB Output is correct
2 Correct 1 ms 1360 KB Output is correct
3 Correct 3 ms 1616 KB Output is correct
4 Correct 2 ms 1616 KB Output is correct
5 Correct 6 ms 1612 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 16 ms 1616 KB Output is correct
8 Correct 5 ms 1616 KB Output is correct
9 Incorrect 9 ms 1620 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2384 KB Output is correct
2 Correct 6 ms 2312 KB Output is correct
3 Correct 7 ms 2384 KB Output is correct
4 Correct 7 ms 2640 KB Output is correct
5 Correct 5 ms 2344 KB Output is correct
6 Correct 4 ms 2384 KB Output is correct
7 Incorrect 5 ms 2384 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2640 KB Output is correct
2 Correct 9 ms 2560 KB Output is correct
3 Execution timed out 4083 ms 2892 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 10020 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -