Submission #769037

# Submission time Handle Problem Language Result Execution time Memory
769037 2023-06-29T05:24:29 Z vjudge1 The Potion of Great Power (CEOI20_potion) C++17
14 / 100
1221 ms 26164 KB
#include<bits/stdc++.h>
#define NN 100100
using namespace std;
int h[NN], n;
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);
    }
    for(int i = 0; i < n; i++) {
        vector<int> b;
        for(auto j: adj[i]) b.push_back(h[j]);
        adj[i].clear();
        for(auto j: b) adj[i].insert(j);
    }

}
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) {
    vector<int> c, d;
    for(auto i: adj[x]) c.push_back(i);
    for(auto i: adj[y]) d.push_back(i);
    return calc(c,d);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4944 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5072 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 290 ms 26140 KB Output is correct
2 Correct 273 ms 26124 KB Output is correct
3 Correct 102 ms 7380 KB Output is correct
4 Correct 860 ms 15952 KB Output is correct
5 Correct 597 ms 25300 KB Output is correct
6 Correct 1221 ms 12624 KB Output is correct
7 Correct 261 ms 12656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 185 ms 26164 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 6096 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4944 KB Incorrect
2 Halted 0 ms 0 KB -