Submission #1089323

# Submission time Handle Problem Language Result Execution time Memory
1089323 2024-09-16T09:56:20 Z vjudge1 Growing Vegetable is Fun 3 (JOI19_ho_t3) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int n;
string s;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>s;
    int cnt=0;
    for(int i=0 ; i<s.size()-2; i++){
    	if(s[i]==s[i+1]){
    		cnt++;
    		char c=s[i+2];
    		s[i+2]=s[i+1];
    		s[i+1]=c;
    	}
    }
    cout<<cnt-1;
}

Compilation message

joi2019_ho_t3.cpp: In function 'int main()':
joi2019_ho_t3.cpp:13:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0 ; i<s.size()-2; i++){
      |                   ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -