제출 #1297210

#제출 시각아이디문제언어결과실행 시간메모리
1297210nguyenkhangninh99Broken Device (JOI17_broken_device)C++20
컴파일 에러
0 ms0 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

void Anna(int n long long x, int k, int p[]){
    vector<int> bad(n), res(n);
    for(int i = 0; i < k; i++) bad[p[i]] 1;
    for(int i = 0; i < n; i += 3){
        if(bad[i] + bad[i + 1] + bad[i + 2] >= 2) continue;
        if(bad[i] + bad[i + 1] + bad[i + 2] == 1){
            if(x % 2 == 0){
                if(bad[i]) res[i + 2] = 1;
                else if(bad[i + 1]) res[i + 2] = 1;
                else res[i] = res[i + 1] = 1;
            }else{
                if(bad[i]){
                    if(x % 4 == 1) res[i + 1] = 1;
                    else res[i + 1] = res[i + 2] = 1;
                    x /= 2;
                }
                if(bad[i + 1]) res[i] = 1;
                if(bad[i + 2]) res[i] = 1;
            }
            x /= 2;
        }else{
            res[i] = res[i + 1] = res[i + 2] = 1;
            if(x % 4 == 1) res[i] = res[i + 2] = 0;
            else if(x % 4 == 2) res[i + 1] = 0;
            else if(x % 4 == 3) res[i] = 0;
            x /= 4;
        }
    }
    for(int i = 0; i < n; i++) Set(i, res[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

void update(int &res, int t){
    if(t == 1) res *= 2;
    if(t == 2) res = res * 4 + 1;
    if(t == 3) res = res * 4 + 3;
    if(t == 4) res = res * 2 + 1;
    if(t == 5) res = res * 4 + 2;
    if(t == 6) res *= 2;
    if(t == 7) res *= 4
}

long long Bruno(int n, int a[]){
    long long res = 0;
    for(int i = n - 3; i >= 0; i -= 3) update(res, 4 * a[i] + 2 * a[i + 1] + a[i + 2]);
    return res;
}

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

# 1번째 컴파일 단계

Anna.cpp:5:17: error: expected ',' or '...' before 'long'
    5 | void Anna(int n long long x, int k, int p[]){
      |                 ^~~~
Anna.cpp: In function 'void Anna(int)':
Anna.cpp:7:24: error: 'k' was not declared in this scope
    7 |     for(int i = 0; i < k; i++) bad[p[i]] 1;
      |                        ^
Anna.cpp:7:36: error: 'p' was not declared in this scope
    7 |     for(int i = 0; i < k; i++) bad[p[i]] 1;
      |                                    ^
Anna.cpp:11:16: error: 'x' was not declared in this scope
   11 |             if(x % 2 == 0){
      |                ^
Anna.cpp:24:13: error: 'x' was not declared in this scope
   24 |             x /= 2;
      |             ^
Anna.cpp:27:16: error: 'x' was not declared in this scope
   27 |             if(x % 4 == 1) res[i] = res[i + 2] = 0;
      |                ^
Anna.cpp:30:13: error: 'x' was not declared in this scope
   30 |             x /= 4;
      |             ^