Language: C++



#include <bits/stdc++.h> using namespace std; void Print(vector<string>& svec, string& str, int i, int j) { svec.push_back(string(str.begin()+i, str.begin()+j+1)); } void Replace(string& str, string target, int i, int j) { str.replace(str.begin()+i, str.begin()+j+1, target); } void Reverse(string& str, int i, int j) { reverse(str.begin()+i, str.begin()+j+1); } int main(int argc, char* argv[]) { string origin; int lines; vector<string> strvec; cin >> origin >> lines; for (int i = 0; i < lines; i++) { string operation; cin >> operation; if(operation=="replace") { int i,j; string tmpstr; cin >> i >> j >> tmpstr; Replace(origin, tmpstr, i, j); }else if(operation=="reverse") { int i,j; cin >> i >> j; Reverse(origin, i, j); }else if(operation=="print") { int i,j; cin >> i >> j; Print(strvec, origin, i, j); } } for (auto var : strvec) { cout << var << endl; } return 0; } 


Compile Error Logs: 

 

Status 
Judge: 16/16 C++11 CPU: 00:00 sec Memory: 3196 KB Length: 1136 B 2018-05-15 14:49 
Results for testcases 
Case # Verdict CPU Time Memory In Out Case Name 

Case #1 : Accepted 00:00 2988 46 5 00_sample_00.in 
Case #2 : Accepted 00:00 3116 42 8 00_sample_01.in 
Case #3 : Accepted 00:00 3144 193 67 01_small_00.in 
Case #4 : Accepted 00:00 3044 275 81 01_small_01.in 
Case #5 : Accepted 00:00 3152 204 59 02_corner_00.in 
Case #6 : Accepted 00:00 3152 281 66 02_corner_01.in 
Case #7 : Accepted 00:00 3144 60 6 02_corner_02.in 
Case #8 : Accepted 00:00 3100 142 15 02_corner_03.in 
Case #9 : Accepted 00:00 3136 143 10 03_rand_00.in 
Case #10 : Accepted 00:00 3144 214 26 03_rand_01.in 
Case #11 : Accepted 00:00 2988 539 94 03_rand_02.in 
Case #12 : Accepted 00:00 3120 842 134 03_rand_03.in 
Case #13 : Accepted 00:00 3160 2175 1497 04_large_00.in 
Case #14 : Accepted 00:00 3136 3997 1552 04_large_01.in 
Case #15 : Accepted 00:00 3196 3817 2931 05_maximum_00.in 
Case #16 : Accepted 00:00 3152 17929 8145 05_maximum_01.in 



 < prev |  /   | next >      

 

Judge Input #  (  | )  Judge Output #  (  | ) 


  

 



 



Compiler output:
a.cc:3:26: warning: extra tokens at end of #include directive
    3 | #include <bits/stdc++.h> using namespace std; void Print(vector<string>& svec, string& str, int i, int j) { svec.push_back(string(str.begin()+i, str.begin()+j+1)); } void Replace(string& str, string target, int i, int j) { str.replace(str.begin()+i, str.begin()+j+1, target); } void Reverse(string& str, int i, int j) { reverse(str.begin()+i, str.begin()+j+1); } int main(int argc, char* argv[]) { string origin; int lines; vector<string> strvec; cin >> origin >> lines; for (int i = 0; i < lines; i++) { string operation; cin >> operation; if(operation=="replace") { int i,j; string tmpstr; cin >> i >> j >> tmpstr; Replace(origin, tmpstr, i, j); }else if(operation=="reverse") { int i,j; cin >> i >> j; Reverse(origin, i, j); }else if(operation=="print") { int i,j; cin >> i >> j; Print(strvec, origin, i, j); } } for (auto var : strvec) { cout << var << endl; } return 0; }
      |                          ^~~~~
a.cc:12:6: error: stray '#' in program
   12 | Results for testcases
      |      ^
a.cc:14:6: error: stray '#' in program
   14 | 
      |      ^
a.cc:15:6: error: stray '#' in program
   15 | Case #1 : Accepted 00:00 2988 46 5 00_sample_00.in
      |      ^
a.cc:16:6: error: stray '#' in program
   16 | Case #2 : Accepted 00:00 3116 42 8 00_sample_01.in
      |      ^
a.cc:17:6: error: stray '#' in program
   17 | Case #3 : Accepted 00:00 3144 193 67 01_small_00.in
      |      ^
a.cc:18:6: error: stray '#' in program
   18 | Case #4 : Accepted 00:00 3044 275 81 01_small_01.in
      |      ^
a.cc:19:6: error: stray '#' in program
   19 | Case #5 : Accepted 00:00 3152 204 59 02_corner_00.in
      |      ^
a.cc:20:6: error: stray '#' in program
   20 | Case #6 : Accepted 00:00 3152 281 66 02_corner_01.in
      |      ^
a.cc:21:6: error: stray '#' in program
   21 | Case #7 : Accepted 00:00 3144 60 6 02_corner_02.in
      |      ^
a.cc:22:6: error: stray '#' in program
   22 | Case #8 : Accepted 00:00 3100 142 15 02_corner_03.in
      |      ^
a.cc:23:6: error: stray '#' in program
   23 | Case #9 : Accepted 00:00 3136 143 10 03_rand_00.in
      |      ^
a.cc:24:6: error: stray '#' in program
   24 | Case #10 : Accepted 00:00 3144 214 26 03_rand_01.in
      |      ^
a.cc:25:6: error: stray '#' in program
   25 | Case #11 : Accepted 00:00 2988 539 94 03_rand_02.in
      |      ^
a.cc:26:6: error: stray '#' in program
   26 | Case #12 : Accepted 00:00 3120 842 134 03_rand_03.in
      |      ^
a.cc:27:6: error: stray '#' in program
   27 | Case #13 : Accepted 00:00 3160 2175 1497 04_large_00.in
      |      ^
a.cc:28:6: error: stray '#' in program
   28 | Case #14 : Accepted 00:00 3136 3997 1552 04_large_01.in
      |      ^
a.cc:29:6: error: stray '#' in program
   29 | Case #15 : Accepted 00:00 3196 3817 2931 05_maximum_00.in
      |      ^
a.cc:37:13: error: stray '#' in program
   37 | 
      |             ^
a.cc:37:37: error: stray '#' in program
   37 | 
      |                                     ^
a.cc:5:1: error: 'Compile' does not name a type
    5 | 
      | ^