Submission #34014


Source Code Expand

Copy
#include <cstdio>
#define SWAP 15
#define HEIGHT 30
using namespace std;

struct pair{
  int a, b;
};

int main(){
  int n, l;
  struct pair amida[ HEIGHT ][ SWAP ];
  int pairnum[ HEIGHT ] = { 0 };
  scanf( "%d%d", &n, &l );
  for( int j = 0; j < l; j++ ){
    for( int i = 0; i < 2 * n - 1; i++ ){
      char c = getchar();
      if( c == '-' ){
        int p = pairnum[ j ];
        amida[ j ][ p ].a = i / 2 - 1;
        amida[ j ][ p ].b = i / 2;
        pairnum[ j ]++;
      }   
    }
    getchar(); // \n
  }
  int temp = 0;
  for( int i = 0; i < 2 * n; i++ ){
    char c = getchar();
    if( c == 'o' ){
      temp =  i / 2;
    }
  }
  
  for( int j = l - 1; j >= 0; j-- ){
    for( int k = 0; k < pairnum[ j ]; k++ ){
      if( temp == amida[ j ][ k ].a ){
        temp = amida[ j ][ k ].b;
        break;
      }else if( temp == amida[ j ][ k ].b ){
        temp = amida[ j ][ k ].a;
        break;
      }
    }
  }
  printf( "%d\n", temp + 1 );

  return 0;
}

Submission Info

Submission Time
Task B - あみだくじ
User rmn_31415
Language C++ (G++ 4.6.4)
Score 100
Code Size 1022 Byte
Status AC
Exec Time 24 ms
Memory 784 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 34
Set Name Test Cases
All 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_maxrnd_00.txt, 02_maxrnd_01.txt, 02_maxrnd_02.txt, 02_maxrnd_03.txt, 02_maxrnd_04.txt, 03_empty_00.txt, 03_empty_01.txt, 03_empty_02.txt
Case Name Status Exec Time Memory
00_min.txt AC 20 ms 672 KB
00_sample_01.txt AC 21 ms 676 KB
00_sample_02.txt AC 19 ms 680 KB
00_sample_03.txt AC 19 ms 652 KB
00_sample_04.txt AC 21 ms 784 KB
00_sample_05.txt AC 20 ms 672 KB
01_rnd_00.txt AC 20 ms 652 KB
01_rnd_01.txt AC 21 ms 672 KB
01_rnd_02.txt AC 21 ms 736 KB
01_rnd_03.txt AC 22 ms 652 KB
01_rnd_04.txt AC 24 ms 656 KB
01_rnd_05.txt AC 19 ms 648 KB
01_rnd_06.txt AC 23 ms 660 KB
01_rnd_07.txt AC 23 ms 728 KB
01_rnd_08.txt AC 21 ms 652 KB
01_rnd_09.txt AC 22 ms 716 KB
01_rnd_10.txt AC 21 ms 732 KB
01_rnd_11.txt AC 18 ms 648 KB
01_rnd_12.txt AC 21 ms 652 KB
01_rnd_13.txt AC 22 ms 716 KB
01_rnd_14.txt AC 20 ms 668 KB
01_rnd_15.txt AC 21 ms 656 KB
01_rnd_16.txt AC 21 ms 656 KB
01_rnd_17.txt AC 20 ms 652 KB
01_rnd_18.txt AC 21 ms 672 KB
01_rnd_19.txt AC 18 ms 728 KB
02_maxrnd_00.txt AC 21 ms 644 KB
02_maxrnd_01.txt AC 19 ms 656 KB
02_maxrnd_02.txt AC 20 ms 652 KB
02_maxrnd_03.txt AC 19 ms 652 KB
02_maxrnd_04.txt AC 21 ms 648 KB
03_empty_00.txt AC 20 ms 656 KB
03_empty_01.txt AC 19 ms 652 KB
03_empty_02.txt AC 20 ms 656 KB