Submission #33626


Source Code Expand

Copy
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <bitset>
#include <queue>
using namespace std;

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

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

//constant
const double EPS = 1e-10;
const int MAXI = 1234567890;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



void printList(vector<int>& v) {
  for (size_t i = 0; i < v.size(); i++) {
	cout << v[i] << " ";
  }
  cout << endl;
}

void printMatrix(vector< vector<int> >& v) {
  for (size_t i = 0; i < v.size(); i++) {
	printList(v[i]);
  }
  cout << endl;
}




int solve(int pos, int y, vector< vector<char> >& map) {
  if (y == 0) return (pos + 1) / 2;

  if (map[y - 1][pos - 1] == '-') return solve(pos - 2, y - 1, map);
  if (map[y - 1][pos + 1] == '-') return solve(pos + 2, y - 1, map);
  return solve(pos, y - 1, map);
}

int main() {
  int x, y;
  cin >> x >> y;
  vector< vector<char> > map(y, vector<char>(2 * x + 1, ' '));
  string null;
  getline(cin, null);
  for (int i = 0; i < y; i++) {
    string t;
    getline(cin, t);
    for (int j = 0; j < SZ(t); j++) {
      map[i][j + 1] = t[j];
    }
  }
  string pos_s;
  int pos = 0;
  getline(cin, pos_s);

  for (int i = 0; i < SZ(pos_s); i++) {
    if (pos_s[i] == 'o') pos = i + 1;
  }
  cout << solve(pos, y, map) << endl;
  return 0;
}

Submission Info

Submission Time
Task B - あみだくじ
User ganatcs
Language C++ (G++ 4.6.4)
Score 100
Code Size 2289 Byte
Status AC
Exec Time 24 ms
Memory 816 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 21 ms 788 KB
00_sample_01.txt AC 23 ms 796 KB
00_sample_02.txt AC 20 ms 792 KB
00_sample_03.txt AC 22 ms 784 KB
00_sample_04.txt AC 21 ms 736 KB
00_sample_05.txt AC 22 ms 788 KB
01_rnd_00.txt AC 22 ms 788 KB
01_rnd_01.txt AC 22 ms 776 KB
01_rnd_02.txt AC 24 ms 764 KB
01_rnd_03.txt AC 21 ms 760 KB
01_rnd_04.txt AC 21 ms 792 KB
01_rnd_05.txt AC 21 ms 792 KB
01_rnd_06.txt AC 21 ms 764 KB
01_rnd_07.txt AC 22 ms 808 KB
01_rnd_08.txt AC 20 ms 792 KB
01_rnd_09.txt AC 21 ms 792 KB
01_rnd_10.txt AC 21 ms 792 KB
01_rnd_11.txt AC 21 ms 792 KB
01_rnd_12.txt AC 21 ms 788 KB
01_rnd_13.txt AC 22 ms 792 KB
01_rnd_14.txt AC 22 ms 764 KB
01_rnd_15.txt AC 21 ms 788 KB
01_rnd_16.txt AC 20 ms 812 KB
01_rnd_17.txt AC 20 ms 736 KB
01_rnd_18.txt AC 20 ms 792 KB
01_rnd_19.txt AC 19 ms 788 KB
02_maxrnd_00.txt AC 22 ms 796 KB
02_maxrnd_01.txt AC 22 ms 764 KB
02_maxrnd_02.txt AC 22 ms 792 KB
02_maxrnd_03.txt AC 20 ms 788 KB
02_maxrnd_04.txt AC 20 ms 788 KB
03_empty_00.txt AC 21 ms 792 KB
03_empty_01.txt AC 21 ms 788 KB
03_empty_02.txt AC 21 ms 816 KB