Submission #33542


Source Code Expand

Copy
//template ver2.00
//------------------------------------------

//include
//------------------------------------------
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

using namespace std;

//conversion
//------------------------------------------
inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
template<class T> inline T is_inner(T x, T a, T b) {return a <= x && x < b;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define MP make_pair
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(c, e) ((c).find(e) != (c).end())

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a);i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

//IO
//------------------------------------------
#define LF(x) cout << (x) << endl;
#define LFA(a, n) cout << a[0]; FOR(itr, 1, n) {cout << " " << a[itr];} cout << endl;
#define LFP(x, w) cout << setprecision((w)); cout << setiosflags(ios::fixed); cout << (x) << endl;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = 1e9;
const int DI[] = {0, 1, 0, -1};
const int DJ[] = {1, 0, -1, 0};

//clear memory
//--------------------------------------------
#define CLR(a) memset((a), 0 , sizeof(a))

//debug
//--------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DUMPA(a, n) cerr << #a << " = {" << a[0]; FOR(itr, 1, n) { cout << ", " << a[itr]; } cerr << "}" << endl;
#define DUMPAA(a, n, m) REP(itr, n) {REP(jtr, m) {cout << a[itr][jtr] << " ";} cout << endl;}

const int N = 10;
const int L = 20;

int n, l;
string amida[L + 1];

bool f(int x)
{
     int k = x;
     REP(i, l) {
	  if (k > 0 && amida[i][2 * k - 1] == '-') {
	       --k;
	  }
	  else if (k < n - 1 && amida[i][2 * k + 1] == '-') {
	       ++k;
	  }
     }
     return amida[l][2 * k] == 'o';
}


void init()
{
}

void solve()
{
     REP(i, n) if (f(i)) {
	       int ans = i + 1;
	       LF(ans);
	       return;
     }
}

int main()
{
     init();
     cin >> n >> l;
     cin.ignore();
     REP(i, l + 1) getline(cin, amida[i]);
     solve();
     return 0;
}

Submission Info

Submission Time
Task B - あみだくじ
User wotsushi
Language C++ (GCC 4.4.7)
Score 100
Code Size 2940 Byte
Status AC
Exec Time 24 ms
Memory 828 KB

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 23 ms 788 KB
00_sample_01.txt AC 24 ms 788 KB
00_sample_02.txt AC 24 ms 784 KB
00_sample_03.txt AC 21 ms 796 KB
00_sample_04.txt AC 20 ms 788 KB
00_sample_05.txt AC 22 ms 796 KB
01_rnd_00.txt AC 21 ms 816 KB
01_rnd_01.txt AC 22 ms 784 KB
01_rnd_02.txt AC 22 ms 740 KB
01_rnd_03.txt AC 24 ms 760 KB
01_rnd_04.txt AC 20 ms 784 KB
01_rnd_05.txt AC 21 ms 792 KB
01_rnd_06.txt AC 22 ms 788 KB
01_rnd_07.txt AC 22 ms 784 KB
01_rnd_08.txt AC 22 ms 792 KB
01_rnd_09.txt AC 21 ms 816 KB
01_rnd_10.txt AC 22 ms 792 KB
01_rnd_11.txt AC 22 ms 784 KB
01_rnd_12.txt AC 21 ms 792 KB
01_rnd_13.txt AC 22 ms 796 KB
01_rnd_14.txt AC 21 ms 764 KB
01_rnd_15.txt AC 21 ms 788 KB
01_rnd_16.txt AC 22 ms 788 KB
01_rnd_17.txt AC 21 ms 796 KB
01_rnd_18.txt AC 22 ms 828 KB
01_rnd_19.txt AC 22 ms 784 KB
02_maxrnd_00.txt AC 21 ms 788 KB
02_maxrnd_01.txt AC 22 ms 792 KB
02_maxrnd_02.txt AC 24 ms 768 KB
02_maxrnd_03.txt AC 23 ms 788 KB
02_maxrnd_04.txt AC 24 ms 784 KB
03_empty_00.txt AC 21 ms 792 KB
03_empty_01.txt AC 23 ms 812 KB
03_empty_02.txt AC 21 ms 788 KB