Submission #541476

# Submission time Handle Problem Language Result Execution time Memory
541476 2022-03-23T16:30:50 Z MohamedFaresNebili Last supper (IOI12_supper) C++14
0 / 100
288 ms 12684 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "advisor.h"
 
        using namespace std;
 
        using ll = long long;
        using ii = pair<ll, ll>;
 
        #define ff first
        #define ss second
        #define pb push_back
        /// #define int ll
 
        const int MOD = 1e9 + 7;
 
        void ComputeAdvice(int C[], int N, int K, int M) {
            int k = 12;
 
            for(int l = 0; l < N; l++) {
                for(int i = 0; i <= k; i++) {
                    if(C[l] & (1 << i))
                        WriteAdvice(1);
                    else WriteAdvice(0);
                }
            }
        }
 
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "assistant.h"
 
        using namespace std;
 
        using ll = long long;
        using ii = pair<ll, ll>;
 
        #define ff first
        #define ss second
        #define pb push_back
        /// #define int ll
 
        const int MOD = 1e9 + 7;
 
        int arr[5001], pw[31], k;
        vector<int> num[5001];
 
        int GetRequest();
        void PutBack(int T);
 
        void Assist(unsigned char *A, int N, int K, int R) {
 
            int i; k = 12; int v = 1;
 
            for(int l = 0; l <= k; l++)
                pw[l] = v, v *= 2;
 
            int m = sizeof(A);
 
            for(int l = 0; l < m; l++) {
                int val = 0;
                for(i = 0; i <= k; i++) {
                    if(A[l + i] == '0') continue;
                    val += pw[k - i];
                }
                arr[val]++; num[val].pb(l); l += k;
            }
 
            set<int> curr;
            for(int l = 0; l < K; l++) curr.insert(l);
            for (i = 0; i < N; i++) {
                int req = GetRequest();
                if(curr.count(req)) continue;
                int in = -1;
                for(int l = 0; l < N; l++) {
                    if(!curr.count(l)) continue;
                    if(arr[l] == 0) {
                        in = l; break;
                    }
                }
                if(in != -1) {
                    PutBack(in); curr.erase(in);
                    curr.insert(req); arr[req]--; continue;
                }
 
                int s = -1;
                for(int l = 0; l < N; l++) {
                    if(!curr.count(l)) continue;
                    if(*num[l].begin() > s) {
                        s = *num[l].begin(), in = l;
                    }
                }
                PutBack(in); curr.erase(in);
                curr.insert(req); arr[req]--;
            }
 
        }
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 900 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 28 ms 2072 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 214 ms 10156 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 636 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 269 ms 12684 KB Execution killed with signal 11
2 Runtime error 288 ms 12464 KB Execution killed with signal 11
3 Runtime error 275 ms 12628 KB Execution killed with signal 11
4 Runtime error 277 ms 12472 KB Execution killed with signal 11
5 Runtime error 265 ms 12588 KB Execution killed with signal 11
6 Runtime error 265 ms 12484 KB Execution killed with signal 11
7 Runtime error 260 ms 12580 KB Execution killed with signal 11
8 Runtime error 262 ms 12528 KB Execution killed with signal 11
9 Runtime error 264 ms 12428 KB Execution killed with signal 11
10 Runtime error 272 ms 12456 KB Execution killed with signal 11