#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define sp " "
//#define endl "\n"
#define pii pair<int, int>
#define st first
#define nd second
vector<int> curr[100005];
int arr[100005], n;
void init(int N, int D, int H[]) {
n = N;
for (int i = 0; i < n; i++) arr[i] = H[i];
}
void curseChanges(int U, int A[], int B[]) {
map<int, int> done[n + 5];
for (int i = 0; i < U; i++)
{
int x = A[i], y = B[i];
if (done[x][y])
{
done[x][y] = 0;
done[y][x] = 0;
}
else
{
done[x][y] = 1;
done[y][x] = 1;
}
}
for (int i = 0; i < n; i++)
{
for (auto j : done[i])
if (j.nd == 1) curr[i].pb(arr[j.st]);
sort(curr[i].begin(), curr[i].end());
cout<<i<<" : ";
for (auto j : curr[i]) cout<<j<<sp;
cout<<endl;
}
}
int question(int x, int y, int v) {
int ans = 1e9;
int i = 0, j = 0;
while(i < curr[x].size() && j < curr[y].size())
{
int a = curr[x][i], b = curr[y][j];
ans = min(ans, abs(a - b));
if (a < b) i++;
else if (b < a) j++;
else return ans;
}
return ans;
}
Compilation message
potion.cpp: In function 'int question(int, int, int)':
potion.cpp:54:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | while(i < curr[x].size() && j < curr[y].size())
| ~~^~~~~~~~~~~~~~~~
potion.cpp:54:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | while(i < curr[x].size() && j < curr[y].size())
| ~~^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2640 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
2768 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
142 ms |
28436 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
140 ms |
28472 KB |
Expected integer, but ":" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
4176 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2640 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |