#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> h;
struct cmp{
bool operator()(const int &a,const int &b)const{
if(h[a]==h[b]){
return a<b;
}
return h[a]<h[b];
}
};
vector<unordered_map<int,vector<pair<int,int>>>> s;
void init(int N, int D, int H[]) {
n=N;
h.resize(n);
s.resize(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];
int b=B[i-1];
if(s[a].find(b)==s[a].end()||s[a][b].back().second==0){
s[a][b].push_back({i,1});
s[b][a].push_back({i,1});
}
else{
s[a][b].push_back({i,0});
s[b][a].push_back({i,0});
}
}
}
int question(int x, int y, int v) {
int ans=1000000000;
vector<int> a(2),b(2);
for(pair<int,vector<pair<int,int>>> j:s[x]){
int tmp=(--upper_bound(j.second.begin(),j.second.end(),make_pair(v,10)))->second;
if(tmp==1){
a[h[j.first]]=1;
}
}
for(pair<int,vector<pair<int,int>>> j:s[y]){
int tmp=(--upper_bound(j.second.begin(),j.second.end(),make_pair(v,10)))->second;
if(tmp==1){
b[h[j.first]]=1;
}
}
if(a[0]==1&&b[0]==1){
return 0;
}
if(a[1]==1&&b[1]==1){
return 0;
}
if(a[0]==1&&b[1]==1){
return 1;
}
if(a[1]==1&&b[0]==1){
return 1;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
1104 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
237 ms |
101656 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
326 ms |
50236 KB |
Output is correct |
2 |
Execution timed out |
3007 ms |
23112 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
9 ms |
6992 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |