Submission #210867


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<ll,ll> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

queue<P> que;
int main() {
  double ans=0;
  string s;
  cin >> s;
  int now=5,k=0,p=0;
  bool b[s.size()];
  memset(b,false,sizeof(b));
  rep(i,s.size()) {
    if(p==0) {
      if(s[i]=='N' && now) {
        ans+=(double)10*((double)1+(double)floor((double)k/10)*0.1);
	now--;
	que.push(P(i+6,1));
	b[i]=true;
      } else if(s[i]=='C' && now>2) {
        ans+=(double)50*((double)1+(double)floor((double)k/10)*0.1);
	now-=3;
	que.push(P(i+8,3));
	p=2;
	b[i]=true;
      }
    } else p--;
    if(!que.empty() && que.front().F==i) {
      now+=que.front().S;
      que.pop();
    }
    if(i) {
      if(b[i-1] && s[i-1]=='N') k++;
    }
    if(i>2) {
      if(b[i-3] && s[i-3]=='C') k++;
    }
  }
  pr((ll)ans);
  return 0;
}

Submission Info

Submission Time
Task B - かぶりん!
User s1200008
Language C++ (G++ 4.6.4)
Score 50
Code Size 1442 Byte
Status
Exec Time 93 ms
Memory 2852 KB

Judge Result

Set Name All
Score / Max Score 50 / 50
Status
× 97
Set Name Test Cases
All 00_sample00.txt, 00_sample01.txt, 00_sample02.txt, 00_small00.txt, 00_small01.txt, 00_small02.txt, 00_small03.txt, 00_small04.txt, 00_small05.txt, 00_small06.txt, 00_small07.txt, 00_small08.txt, 00_small09.txt, 00_small10.txt, 00_small11.txt, 00_small12.txt, 00_small13.txt, 00_small14.txt, 00_small15.txt, 00_small16.txt, 00_small17.txt, 00_small18.txt, 00_small19.txt, 00_small20.txt, 00_small21.txt, 00_small22.txt, 00_small23.txt, 00_small24.txt, 00_small25.txt, 00_small26.txt, 00_small27.txt, 00_small28.txt, 00_small29.txt, 01_medium00.txt, 01_medium01.txt, 01_medium02.txt, 01_medium03.txt, 01_medium04.txt, 01_medium05.txt, 01_medium06.txt, 01_medium07.txt, 01_medium08.txt, 01_medium09.txt, 01_medium10.txt, 01_medium11.txt, 01_medium12.txt, 01_medium13.txt, 01_medium14.txt, 01_medium15.txt, 01_medium16.txt, 01_medium17.txt, 01_medium18.txt, 01_medium19.txt, 01_medium20.txt, 01_medium21.txt, 01_medium22.txt, 01_medium23.txt, 01_medium24.txt, 01_medium25.txt, 01_medium26.txt, 01_medium27.txt, 01_medium28.txt, 01_medium29.txt, 02_large00.txt, 02_large01.txt, 02_large02.txt, 02_large03.txt, 02_large04.txt, 02_large05.txt, 02_large06.txt, 02_large07.txt, 02_large08.txt, 02_large09.txt, 02_large10.txt, 02_large11.txt, 02_large12.txt, 02_large13.txt, 02_large14.txt, 02_large15.txt, 02_large16.txt, 02_large17.txt, 02_large18.txt, 02_large19.txt, 02_large20.txt, 02_large21.txt, 02_large22.txt, 02_large23.txt, 02_large24.txt, 02_large25.txt, 02_large26.txt, 02_large27.txt, 02_large28.txt, 02_large29.txt, 03_manual00.txt, 03_manual01.txt, 03_manual02.txt, 03_manual03.txt
Case Name Status Exec Time Memory
00_sample00.txt 22 ms 680 KB
00_sample01.txt 22 ms 800 KB
00_sample02.txt 22 ms 916 KB
00_small00.txt 23 ms 796 KB
00_small01.txt 22 ms 796 KB
00_small02.txt 21 ms 928 KB
00_small03.txt 21 ms 924 KB
00_small04.txt 21 ms 792 KB
00_small05.txt 22 ms 924 KB
00_small06.txt 22 ms 804 KB
00_small07.txt 21 ms 740 KB
00_small08.txt 22 ms 736 KB
00_small09.txt 22 ms 804 KB
00_small10.txt 21 ms 928 KB
00_small11.txt 21 ms 804 KB
00_small12.txt 22 ms 704 KB
00_small13.txt 21 ms 792 KB
00_small14.txt 22 ms 676 KB
00_small15.txt 21 ms 924 KB
00_small16.txt 21 ms 800 KB
00_small17.txt 22 ms 796 KB
00_small18.txt 23 ms 920 KB
00_small19.txt 22 ms 796 KB
00_small20.txt 23 ms 928 KB
00_small21.txt 23 ms 792 KB
00_small22.txt 24 ms 920 KB
00_small23.txt 22 ms 788 KB
00_small24.txt 22 ms 800 KB
00_small25.txt 22 ms 804 KB
00_small26.txt 24 ms 788 KB
00_small27.txt 22 ms 804 KB
00_small28.txt 23 ms 796 KB
00_small29.txt 22 ms 796 KB
01_medium00.txt 21 ms 924 KB
01_medium01.txt 21 ms 932 KB
01_medium02.txt 22 ms 728 KB
01_medium03.txt 22 ms 804 KB
01_medium04.txt 22 ms 932 KB
01_medium05.txt 22 ms 736 KB
01_medium06.txt 22 ms 800 KB
01_medium07.txt 22 ms 676 KB
01_medium08.txt 21 ms 920 KB
01_medium09.txt 22 ms 732 KB
01_medium10.txt 22 ms 800 KB
01_medium11.txt 23 ms 792 KB
01_medium12.txt 22 ms 808 KB
01_medium13.txt 22 ms 932 KB
01_medium14.txt 24 ms 924 KB
01_medium15.txt 24 ms 788 KB
01_medium16.txt 21 ms 796 KB
01_medium17.txt 22 ms 912 KB
01_medium18.txt 22 ms 740 KB
01_medium19.txt 22 ms 736 KB
01_medium20.txt 22 ms 732 KB
01_medium21.txt 21 ms 928 KB
01_medium22.txt 23 ms 676 KB
01_medium23.txt 21 ms 804 KB
01_medium24.txt 22 ms 928 KB
01_medium25.txt 21 ms 920 KB
01_medium26.txt 22 ms 804 KB
01_medium27.txt 22 ms 808 KB
01_medium28.txt 21 ms 924 KB
01_medium29.txt 22 ms 796 KB
02_large00.txt 69 ms 2220 KB
02_large01.txt 60 ms 1956 KB
02_large02.txt 40 ms 1448 KB
02_large03.txt 86 ms 2728 KB
02_large04.txt 57 ms 1832 KB
02_large05.txt 61 ms 2020 KB
02_large06.txt 33 ms 1196 KB
02_large07.txt 86 ms 2332 KB
02_large08.txt 63 ms 2084 KB
02_large09.txt 46 ms 1568 KB
02_large10.txt 85 ms 2728 KB
02_large11.txt 23 ms 800 KB
02_large12.txt 27 ms 1184 KB
02_large13.txt 41 ms 1448 KB
02_large14.txt 57 ms 1820 KB
02_large15.txt 60 ms 1960 KB
02_large16.txt 63 ms 2080 KB
02_large17.txt 29 ms 1124 KB
02_large18.txt 43 ms 1448 KB
02_large19.txt 84 ms 2600 KB
02_large20.txt 23 ms 804 KB
02_large21.txt 38 ms 1316 KB
02_large22.txt 25 ms 1048 KB
02_large23.txt 70 ms 2216 KB
02_large24.txt 42 ms 1452 KB
02_large25.txt 43 ms 1452 KB
02_large26.txt 30 ms 1068 KB
02_large27.txt 69 ms 2216 KB
02_large28.txt 54 ms 1840 KB
02_large29.txt 72 ms 2348 KB
03_manual00.txt 93 ms 2852 KB
03_manual01.txt 79 ms 2852 KB
03_manual02.txt 78 ms 2852 KB
03_manual03.txt 22 ms 928 KB