Submission #769024

# Submission time Handle Problem Language Result Execution time Memory
769024 2023-06-29T05:16:45 Z boyliguanhan The Potion of Great Power (CEOI20_potion) C++17
0 / 100
3000 ms 31436 KB
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#define NN 100100
using namespace std;
int h[NN], n;
unordered_set<int> adj[NN];
void init(int N, int D, int H[]) {
    n = N;
    for(int i = 0; i < N; i++)
        h[i] = H[i];
}
void curseChanges(int U, int A[], int B[]) {
    for(int i = 1; i <= U; i++) {
        int a= A[i-1], b = B[i-1];
        if(adj[a].count(b)) adj[a].erase(b), adj[b].erase(a);
        else adj[a].insert(b), adj[b].insert(a);
    }
}
int calc(vector<int> a, vector<int> b){
    int ans = 1e9;
    for(int i = 0, j = 0; i < (int)a.size()&&j < (int)b.size();i++) {
        if(a[i]>b[j]) swap(a, b), swap(i, j);
        if(j) ans=min(ans,(int)abs(a[i]-b[j-1]));
        ans = min(ans, abs(a[i] - b[j]));
    }
    return ans;
}
int question(int x, int y, int v) {
    unordered_set<int> a = adj[x], b = adj[y];
    vector<int> c, d;
    for(auto i: a) c.push_back(h[i]);
    for(auto i: b) d.push_back(h[i]);
    sort(c.begin(), c.end());
    sort(d.begin(), d.end());
    return calc(c,d);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5712 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 5968 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 260 ms 31384 KB Output is correct
2 Correct 265 ms 31352 KB Output is correct
3 Correct 154 ms 8156 KB Output is correct
4 Correct 1817 ms 15676 KB Output is correct
5 Correct 595 ms 24712 KB Output is correct
6 Execution timed out 3030 ms 21636 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 31436 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 7504 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5712 KB Incorrect
2 Halted 0 ms 0 KB -