Submission #530729

#TimeUsernameProblemLanguageResultExecution timeMemory
530729ammar2000Magnus (COCI18_magnus)C++17
50 / 50
2 ms592 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define F first #define S second #define coy cout<<"YES\n" #define con cout<<"NO\n" #define co1 cout<<"-1\n" #define sc(x) scanf("%lld",&x) #define all(x) x.begin(),x.end() #define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; const int SI=3e5+7; ll INF=8e18+7; int dx[] = {1 , -1 , 0 , 0}; int dy[] = {0 , 0 , 1 , -1}; int MOD=1e9+7; ll n; string s; int main() { fast cin>>s; n=s.size(); string h="HONI"; ll in=0; ll ans=0; for (auto i:s) { if (in==3&&i==h[in]) ans++; if(i==h[in]) in++,in%=4; } cout <<ans<<"\n"; // use scanf not cin return 0; }

Compilation message (stderr)

magnus.cpp: In function 'int main()':
magnus.cpp:30:8: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   30 |        if (in==3&&i==h[in])
      |        ^~
magnus.cpp:32:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   32 |         if(i==h[in])
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...