Submission #63770651


Source Code Expand

#include<bits/stdc++.h>
#define int long long
#define mod 1000000007LL
#define endl '\n'
#define pii pair<int,int>
#define Mikari_My_Wife ios::sync_with_stdio(0),cin.tie(0);
#define all(x) x.begin(),x.end()
using namespace std;
void solve(){
    /*int n;
    cin>>n;
    vector<int>a(n);
    for(auto &c:a)cin>>c;
    map<int,int>aa,bb;
    for(auto c:a){
        bb[c]++;
    }*/

    string s;
    cin>>s;
    int ans=0;

    for(int i=0;i<s.size();i++){
        if(s[i]=='i'&&(i+ans)%2==0){
            continue;
        }
        if(s[i]=='o'&&(i+ans)%2==1){
            continue;;
        }
        else ans++;
    }
    if((ans+s.size())%2==1)ans++;
    cout<<ans<<endl;

}
signed main(){
    //注意多筆測資輸入!!!
    Mikari_My_Wife
    int t=1;
    //cin>>t;
    while(t--){solve();}
}

Submission Info

Submission Time
Task B - Ticket Gate Log
User zihan_ayame
Language C++ 20 (gcc 12.2)
Score 250
Code Size 848 Byte
Status AC
Exec Time 1 ms
Memory 3616 KiB

Compile Error

Main.cpp: In function ‘void solve()’:
Main.cpp:23:18: 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]
   23 |     for(int i=0;i<s.size();i++){
      |                 ~^~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 3
AC × 17
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3560 KiB
00_sample_02.txt AC 1 ms 3356 KiB
00_sample_03.txt AC 1 ms 3496 KiB
01_random_01.txt AC 1 ms 3400 KiB
01_random_02.txt AC 1 ms 3356 KiB
01_random_03.txt AC 1 ms 3500 KiB
01_random_04.txt AC 1 ms 3344 KiB
01_random_05.txt AC 1 ms 3488 KiB
01_random_06.txt AC 1 ms 3432 KiB
01_random_07.txt AC 1 ms 3484 KiB
01_random_08.txt AC 1 ms 3360 KiB
01_random_09.txt AC 1 ms 3616 KiB
01_random_10.txt AC 1 ms 3420 KiB
02_handmade_01.txt AC 1 ms 3488 KiB
02_handmade_02.txt AC 1 ms 3424 KiB
02_handmade_03.txt AC 1 ms 3616 KiB
02_handmade_04.txt AC 1 ms 3556 KiB