Submission #1655390


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true

typedef long long ll;
typedef pair<int, int> ii;

int main(){

  string s;
  cin >> s;
  int k;
  cin >> k;

  int na_cnt = 0;
  rep(i, s.size()) if(s[i] != 'a') na_cnt++;
  if(na_cnt<= k){
    rep(i, s.size() - k) cout << 'a';
    cout << endl;
  }
  else{
    assert(false);
    ll cnt = 0;
    rep(i, s.size()){
      if(s[i] == 'a') cnt++;
      else{
        bool f = true;
        string buff;
        ll tmp = 0;
        int tk = k;
        REP(j, i, s.size()){
          if(s[j] !=  'a') tk--;
          if(tk < 0) {
            i = s.size();
            break;
          }

        }
        cnt += tmp;
      }
    }
  }


	return 0;
}

Submission Info

Submission Time
Task C - アメージングな文字列は、きみが作る!
User letter
Language C++14 (GCC 5.4.1)
Score 0
Code Size 921 Byte
Status RE
Exec Time 109 ms
Memory 900 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3 All
Score / Max Score 0 / 0 0 / 10 0 / 10 0 / 20 0 / 60
Status
AC × 1
RE × 2
AC × 3
RE × 10
AC × 5
RE × 23
AC × 7
RE × 36
AC × 9
RE × 53
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
Subtask1 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 20_hand_01.txt, 20_hand_02.txt, 20_hand_03.txt, 20_hand_04.txt, 20_hand_05.txt
Subtask2 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 20_hand_01.txt, 20_hand_02.txt, 20_hand_03.txt, 20_hand_04.txt, 20_hand_05.txt, 40_rand_01.txt, 40_rand_02.txt, 40_rand_03.txt, 40_rand_04.txt, 40_rand_05.txt, 40_rand_06.txt, 40_rand_07.txt, 40_rand_08.txt, 40_rand_09.txt, 40_rand_10.txt, 50_hand_01.txt, 50_hand_02.txt, 50_hand_03.txt, 50_hand_04.txt, 50_hand_05.txt
Subtask3 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 20_hand_01.txt, 20_hand_02.txt, 20_hand_03.txt, 20_hand_04.txt, 20_hand_05.txt, 40_rand_01.txt, 40_rand_02.txt, 40_rand_03.txt, 40_rand_04.txt, 40_rand_05.txt, 40_rand_06.txt, 40_rand_07.txt, 40_rand_08.txt, 40_rand_09.txt, 40_rand_10.txt, 50_hand_01.txt, 50_hand_02.txt, 50_hand_03.txt, 50_hand_04.txt, 50_hand_05.txt, 60_rand_01.txt, 60_rand_02.txt, 60_rand_03.txt, 60_rand_04.txt, 60_rand_05.txt, 60_rand_06.txt, 60_rand_07.txt, 60_rand_08.txt, 70_hand_01.txt, 70_hand_02.txt, 70_hand_03.txt, 70_hand_04.txt, 70_hand_05.txt, 70_hand_06.txt, 70_hand_07.txt
All 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 20_hand_01.txt, 20_hand_02.txt, 20_hand_03.txt, 20_hand_04.txt, 20_hand_05.txt, 40_rand_01.txt, 40_rand_02.txt, 40_rand_03.txt, 40_rand_04.txt, 40_rand_05.txt, 40_rand_06.txt, 40_rand_07.txt, 40_rand_08.txt, 40_rand_09.txt, 40_rand_10.txt, 50_hand_01.txt, 50_hand_02.txt, 50_hand_03.txt, 50_hand_04.txt, 50_hand_05.txt, 60_rand_01.txt, 60_rand_02.txt, 60_rand_03.txt, 60_rand_04.txt, 60_rand_05.txt, 60_rand_06.txt, 60_rand_07.txt, 60_rand_08.txt, 70_hand_01.txt, 70_hand_02.txt, 70_hand_03.txt, 70_hand_04.txt, 70_hand_05.txt, 70_hand_06.txt, 70_hand_07.txt, 80_rand_01.txt, 80_rand_02.txt, 80_rand_03.txt, 80_rand_04.txt, 80_rand_05.txt, 80_rand_06.txt, 80_rand_07.txt, 80_rand_08.txt, 80_rand_09.txt, 80_rand_10.txt, 90_hand_01.txt, 90_hand_02.txt, 90_hand_03.txt, 90_hand_04.txt, 90_hand_05.txt, 90_hand_06.txt, 90_hand_07.txt, 90_hand_08.txt, 90_hand_09.txt
Case Name Status Exec Time Memory
00_example_01.txt RE 97 ms 384 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt RE 98 ms 256 KB
10_rand_01.txt RE 97 ms 256 KB
10_rand_02.txt RE 98 ms 256 KB
10_rand_03.txt RE 97 ms 256 KB
10_rand_04.txt RE 97 ms 256 KB
10_rand_05.txt RE 97 ms 256 KB
20_hand_01.txt AC 1 ms 256 KB
20_hand_02.txt AC 1 ms 256 KB
20_hand_03.txt RE 97 ms 256 KB
20_hand_04.txt RE 97 ms 256 KB
20_hand_05.txt RE 97 ms 256 KB
40_rand_01.txt RE 97 ms 256 KB
40_rand_02.txt RE 98 ms 256 KB
40_rand_03.txt RE 101 ms 256 KB
40_rand_04.txt RE 98 ms 256 KB
40_rand_05.txt RE 98 ms 256 KB
40_rand_06.txt RE 98 ms 256 KB
40_rand_07.txt RE 97 ms 256 KB
40_rand_08.txt RE 98 ms 256 KB
40_rand_09.txt RE 99 ms 256 KB
40_rand_10.txt RE 97 ms 256 KB
50_hand_01.txt AC 1 ms 256 KB
50_hand_02.txt AC 1 ms 256 KB
50_hand_03.txt RE 98 ms 256 KB
50_hand_04.txt RE 98 ms 256 KB
50_hand_05.txt RE 98 ms 256 KB
60_rand_01.txt RE 97 ms 256 KB
60_rand_02.txt RE 98 ms 256 KB
60_rand_03.txt RE 98 ms 256 KB
60_rand_04.txt RE 97 ms 256 KB
60_rand_05.txt RE 98 ms 256 KB
60_rand_06.txt RE 97 ms 256 KB
60_rand_07.txt RE 97 ms 256 KB
60_rand_08.txt RE 98 ms 256 KB
70_hand_01.txt AC 1 ms 256 KB
70_hand_02.txt AC 1 ms 256 KB
70_hand_03.txt RE 97 ms 256 KB
70_hand_04.txt RE 97 ms 256 KB
70_hand_05.txt RE 97 ms 256 KB
70_hand_06.txt RE 97 ms 256 KB
70_hand_07.txt RE 97 ms 256 KB
80_rand_01.txt RE 104 ms 640 KB
80_rand_02.txt RE 101 ms 512 KB
80_rand_03.txt RE 105 ms 644 KB
80_rand_04.txt RE 103 ms 640 KB
80_rand_05.txt RE 104 ms 640 KB
80_rand_06.txt RE 104 ms 640 KB
80_rand_07.txt RE 105 ms 644 KB
80_rand_08.txt RE 106 ms 640 KB
80_rand_09.txt RE 108 ms 644 KB
80_rand_10.txt RE 101 ms 512 KB
90_hand_01.txt AC 18 ms 900 KB
90_hand_02.txt AC 13 ms 900 KB
90_hand_03.txt RE 107 ms 900 KB
90_hand_04.txt RE 107 ms 900 KB
90_hand_05.txt RE 106 ms 900 KB
90_hand_06.txt RE 106 ms 900 KB
90_hand_07.txt RE 107 ms 900 KB
90_hand_08.txt RE 107 ms 900 KB
90_hand_09.txt RE 109 ms 900 KB