제출 #1368165

#제출 시각아이디문제언어결과실행 시간메모리
1368165mikasaHack (APIO25_hack)C++20
100 / 100
1 ms344 KiB
#include "hack.h"
#include <vector>
using namespace std;

long long m = 0; 

int hack(){

    volatile int* bss = (volatile int*)&m;
    const int RADI = 200;
    vector<int> snap(RADI*2);

    for (int i=-RADI;i<RADI;++i) {
        snap[i+RADI]=bss[i];
    }

    collisions({1});
    volatile int* ptr=nullptr;
    for (int i=-RADI;i<RADI;++i) {
        if (bss[i]==snap[i+RADI]+1){
            ptr=&bss[i];
            break;
        }
    }
    if (ptr!=nullptr) {
        *ptr=0;
        int n = *(ptr-1);
        if (n<=0) {
            n=*(ptr+1);
        }

        return n;
    }
}

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

hack.cpp: In function 'int hack()':
hack.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…