Submission #92043


Source Code Expand

Copy
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include<cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include<bitset>

#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define FOR(it,o)  for(__typeof((o).begin()) it=(o).begin(); it!=(o).end(); ++it)
#define dbg(x) cout << __LINE__ << ' ' << #x << " = " << (x) << endl


typedef long long ll;

using namespace std;
int B, L, N;
int cnt, pos;

string in ;
char res[1050];

int num(){
  int ret = 0;
  while(isdigit(in[pos])){
    ret *= 10;
    ret += in[pos] - '0';
    pos++;
  }
  return ret-1;
}

pair<int, int> parse(){
  if(in[pos]=='@')return make_pair(cnt, cnt);
  pair<int, int> ret;
  ret.first = cnt;
  while(1){
    if(isalpha(in[pos])){
      res[cnt++] = in[pos];
      pos++;
    }else if(in[pos] == '('){
      pos++;
      pair<int, int> hoge = parse();
      pos++;
      int n = num();
      rep(i, n){
	REP(j, hoge.first, hoge.second){
	  res[cnt++] = res[j];
	}
      }
    }
    else{
      break;
    }
  }
  ret.second = cnt;
  return ret;
}

int main(){
  while(cin >> B >> L >> N){
    assert(L <=100 && N <=100);
    cnt = pos = 0;
    cin >> in;
    pair<int, int> pii = parse();\
    if(B < 0){
      B += pii.second;
    }
    REP(i, B, B+L){
      cout << res[i];
    }
    cout << endl;

  }
  return 0;
}

Submission Info

Submission Time
Task D - 天下一展開
User shioshiota
Language C++ (G++ 4.6.4)
Score 50
Code Size 1691 Byte
Status WA
Exec Time 379 ms
Memory 816 KB

Judge Result

Set Name small medium large
Score / Max Score 50 / 50 0 / 50 0 / 30
Status
AC × 34
AC × 36
WA × 20
RE × 10
AC × 36
WA × 40
RE × 13
Set Name Test Cases
small small, small/01_manual1, small/01_manual2, small/01_sample2, small/10_manual3, small/11_small00, small/11_small01, small/11_small02, small/11_small03, small/11_small04, small/11_small05, small/11_small06, small/11_small07, small/11_small08, small/11_small09, small/11_small10, small/11_small11, small/11_small12, small/11_small13, small/11_small14, small/11_small15, small/11_small16, small/11_small17, small/11_small18, small/11_small19, small/11_small20, small/11_small21, small/11_small22, small/11_small23, small/11_small24, small/11_small25, small/11_small26, small/11_small27, small/11_small28, small/11_small29
medium small, small/01_manual1, small/01_manual2, small/01_sample2, small/10_manual3, small/11_small00, small/11_small01, small/11_small02, small/11_small03, small/11_small04, small/11_small05, small/11_small06, small/11_small07, small/11_small08, small/11_small09, small/11_small10, small/11_small11, small/11_small12, small/11_small13, small/11_small14, small/11_small15, small/11_small16, small/11_small17, small/11_small18, small/11_small19, small/11_small20, small/11_small21, small/11_small22, small/11_small23, small/11_small24, small/11_small25, small/11_small26, small/11_small27, small/11_small28, small/11_small29, medium, medium/20_manual5, medium/20_manual6, medium/21_medium30, medium/21_medium31, medium/21_medium32, medium/21_medium33, medium/21_medium34, medium/21_medium35, medium/21_medium36, medium/21_medium37, medium/21_medium38, medium/21_medium39, medium/21_medium40, medium/21_medium41, medium/21_medium42, medium/21_medium43, medium/21_medium44, medium/21_medium45, medium/21_medium46, medium/21_medium47, medium/21_medium48, medium/21_medium49, medium/21_medium50, medium/21_medium51, medium/21_medium52, medium/21_medium53, medium/21_medium54, medium/21_medium55, medium/21_medium56, medium/21_medium57, medium/21_medium58, medium/21_medium59
large large, medium, small, large/30_manual4, large/30_manual7, large/31_large60, large/31_large61, large/31_large62, large/31_large63, large/31_large64, large/31_large65, large/31_large66, large/31_large67, large/31_large68, large/31_large69, large/32_large70, large/32_large71, large/32_large72, large/32_large73, large/32_large74, large/32_large75, large/32_large76, large/32_large77, large/32_large78, large/32_large79, large/33_large80, medium/20_manual5, medium/20_manual6, medium/21_medium30, medium/21_medium31, medium/21_medium32, medium/21_medium33, medium/21_medium34, medium/21_medium35, medium/21_medium36, medium/21_medium37, medium/21_medium38, medium/21_medium39, medium/21_medium40, medium/21_medium41, medium/21_medium42, medium/21_medium43, medium/21_medium44, medium/21_medium45, medium/21_medium46, medium/21_medium47, medium/21_medium48, medium/21_medium49, medium/21_medium50, medium/21_medium51, medium/21_medium52, medium/21_medium53, medium/21_medium54, medium/21_medium55, medium/21_medium56, medium/21_medium57, medium/21_medium58, medium/21_medium59, small/01_manual1, small/01_manual2, small/01_sample2, small/10_manual3, small/11_small00, small/11_small01, small/11_small02, small/11_small03, small/11_small04, small/11_small05, small/11_small06, small/11_small07, small/11_small08, small/11_small09, small/11_small10, small/11_small11, small/11_small12, small/11_small13, small/11_small14, small/11_small15, small/11_small16, small/11_small17, small/11_small18, small/11_small19, small/11_small20, small/11_small21, small/11_small22, small/11_small23, small/11_small24, small/11_small25, small/11_small26, small/11_small27, small/11_small28, small/11_small29
Case Name Status Exec Time Memory
large/30_manual4 RE 379 ms 788 KB
large/30_manual7 RE 247 ms 788 KB
large/31_large60 WA 20 ms 680 KB
large/31_large61 WA 20 ms 788 KB
large/31_large62 WA 19 ms 656 KB
large/31_large63 WA 18 ms 792 KB
large/31_large64 WA 18 ms 816 KB
large/31_large65 WA 18 ms 780 KB
large/31_large66 WA 19 ms 784 KB
large/31_large67 WA 20 ms 668 KB
large/31_large68 WA 19 ms 788 KB
large/31_large69 WA 20 ms 688 KB
large/32_large70 WA 19 ms 664 KB
large/32_large71 WA 19 ms 788 KB
large/32_large72 WA 18 ms 788 KB
large/32_large73 WA 19 ms 788 KB
large/32_large74 WA 19 ms 788 KB
large/32_large75 WA 18 ms 784 KB
large/32_large76 WA 19 ms 792 KB
large/32_large77 WA 18 ms 792 KB
large/32_large78 WA 19 ms 816 KB
large/32_large79 WA 21 ms 656 KB
large/33_large80 RE 247 ms 768 KB
medium/20_manual5 RE 246 ms 636 KB
medium/20_manual6 RE 250 ms 788 KB
medium/21_medium30 RE 252 ms 784 KB
medium/21_medium31 WA 20 ms 780 KB
medium/21_medium32 RE 256 ms 788 KB
medium/21_medium33 WA 19 ms 788 KB
medium/21_medium34 AC 22 ms 636 KB
medium/21_medium35 RE 244 ms 792 KB
medium/21_medium36 RE 246 ms 696 KB
medium/21_medium37 RE 246 ms 788 KB
medium/21_medium38 AC 20 ms 788 KB
medium/21_medium39 RE 253 ms 792 KB
medium/21_medium40 WA 21 ms 640 KB
medium/21_medium41 WA 20 ms 792 KB
medium/21_medium42 WA 20 ms 692 KB
medium/21_medium43 WA 20 ms 788 KB
medium/21_medium44 WA 19 ms 788 KB
medium/21_medium45 WA 19 ms 792 KB
medium/21_medium46 WA 20 ms 788 KB
medium/21_medium47 RE 256 ms 788 KB
medium/21_medium48 WA 18 ms 792 KB
medium/21_medium49 RE 244 ms 796 KB
medium/21_medium50 WA 18 ms 788 KB
medium/21_medium51 WA 20 ms 688 KB
medium/21_medium52 WA 20 ms 712 KB
medium/21_medium53 WA 20 ms 692 KB
medium/21_medium54 WA 19 ms 788 KB
medium/21_medium55 WA 19 ms 784 KB
medium/21_medium56 WA 20 ms 788 KB
medium/21_medium57 WA 20 ms 792 KB
medium/21_medium58 WA 20 ms 788 KB
medium/21_medium59 WA 20 ms 788 KB
small/01_manual1 AC 20 ms 784 KB
small/01_manual2 AC 19 ms 792 KB
small/01_sample2 AC 20 ms 792 KB
small/10_manual3 AC 21 ms 788 KB
small/11_small00 AC 21 ms 636 KB
small/11_small01 AC 21 ms 784 KB
small/11_small02 AC 21 ms 784 KB
small/11_small03 AC 21 ms 784 KB
small/11_small04 AC 21 ms 788 KB
small/11_small05 AC 20 ms 768 KB
small/11_small06 AC 24 ms 772 KB
small/11_small07 AC 21 ms 788 KB
small/11_small08 AC 20 ms 784 KB
small/11_small09 AC 18 ms 784 KB
small/11_small10 AC 20 ms 784 KB
small/11_small11 AC 19 ms 788 KB
small/11_small12 AC 19 ms 660 KB
small/11_small13 AC 20 ms 792 KB
small/11_small14 AC 20 ms 780 KB
small/11_small15 AC 19 ms 788 KB
small/11_small16 AC 21 ms 800 KB
small/11_small17 AC 19 ms 788 KB
small/11_small18 AC 20 ms 788 KB
small/11_small19 AC 19 ms 784 KB
small/11_small20 AC 21 ms 788 KB
small/11_small21 AC 19 ms 784 KB
small/11_small22 AC 20 ms 780 KB
small/11_small23 AC 18 ms 784 KB
small/11_small24 AC 19 ms 792 KB
small/11_small25 AC 22 ms 780 KB
small/11_small26 AC 21 ms 788 KB
small/11_small27 AC 20 ms 784 KB
small/11_small28 AC 19 ms 792 KB
small/11_small29 AC 21 ms 632 KB