# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
26940 |
2017-07-07T09:53:16 Z |
검수팍(#1115) |
Bulb Game (FXCUP2_bulb) |
C++ |
|
0 ms |
0 KB |
#include <stdio.h>
#include <stdlib.h>
#include "bulb.h"
static int N;
static int sw[1010], bulb[1010], on, off;
static void my_assert(bool TF, const char* message){
if(!TF){ puts(message); exit(1); }
}
int main(){
int seed;
my_assert(scanf("fxcup2\n%d\n%d", &N, &seed) == 2, "Error: Invalid N");
my_assert(2 <= N && N <= 1000 && N%2 == 0, "Error: Invalid N");
srand(seed);
Init(N);
for(int i=0; i<N/2; i++){
int mh, sy;
do{ mh = rand()%N+1; } while(sw[mh]);
sw[mh] = 1;
sy = MakeTurn(mh);
my_assert(1 <= sy && sy <= N && sw[sy]==0, "����[2]");
if(mh <= sy) for(int x=mh; x<sy; x++) bulb[x] = 1-bulb[x];
else for(int x=sy; x<mh; x++) bulb[x] = 1-bulb[x];
}
for(int x=1; x<N; x++){
if(bulb[x] == 1) on++;
else off++;
}
my_assert(on>off, "����[1]");
puts("A$jgS(V1u(@A6F");
return 0;
}
Compilation message
/tmp/ccHpFzbx.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc6Vm4pt.o:bulb.cpp:(.text.startup+0x0): first defined here
/tmp/cc6Vm4pt.o: In function `main':
bulb.cpp:(.text.startup+0x64): undefined reference to `Init(int)'
bulb.cpp:(.text.startup+0xab): undefined reference to `MakeTurn(int)'
/tmp/ccHpFzbx.o: In function `main':
grader.cpp:(.text.startup+0x64): undefined reference to `Init(int)'
grader.cpp:(.text.startup+0xab): undefined reference to `MakeTurn(int)'
collect2: error: ld returned 1 exit status