답안 #1073484

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1073484 2024-08-24T15:17:40 Z blushingecchigirl 식물 비교 (IOI20_plants) C++17
0 / 100
33 ms 4176 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

vector<pair<pair<int, int>, int>> p;

void init(int k, std::vector<int> r) {
    int n = r.size(), x;
    p.resize(n);
    for(int i = 0; i<n; i++) {
        if(r[i]!=r[(i+1)%n]) {
            x = i;
            break;
        }
    }
    int cur = 0, g = 0;

    for(int i = x; i<n+x; i++) {
        p[i%n].second = cur;
        if(r[i%n]) cur--;
        else cur++;
        p[i%n].first.first = p[(i+1)%n].first.second = g;
        if(r[i%n] != r[(i+1)%n]) g++;
    }
    return;
}
int compare_plants(int x, int y) {
    auto a = p[x].first, b = p[y].first;
    if(a.first == b.second || a.second == b.first) {
        if(p[x].second>p[y].second) return -1;
        return 1;
    }
    return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:19:23: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |     for(int i = x; i<n+x; i++) {
      |                      ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Incorrect 33 ms 4176 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Incorrect 33 ms 4176 KB Output isn't correct
7 Halted 0 ms 0 KB -