답안 #669611

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
669611 2022-12-06T20:29:45 Z dozer The Potion of Great Power (CEOI20_potion) C++14
14 / 100
385 ms 32324 KB
#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 Correct 242 ms 32324 KB Output is correct
2 Correct 271 ms 32312 KB Output is correct
3 Correct 91 ms 9704 KB Output is correct
4 Correct 363 ms 18164 KB Output is correct
5 Correct 320 ms 26020 KB Output is correct
6 Correct 385 ms 20344 KB Output is correct
7 Correct 177 ms 20376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 211 ms 32228 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 4432 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2640 KB Incorrect
2 Halted 0 ms 0 KB -