제출 #669610

#제출 시각아이디문제언어결과실행 시간메모리
669610dozerThe Potion of Great Power (CEOI20_potion)C++14
0 / 100
142 ms28472 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

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())
      |                                 ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...