Submission #1093867

#TimeUsernameProblemLanguageResultExecution timeMemory
1093867AlmontherVještica (COCI16_vjestica)C++98
0 / 160
13 ms1376 KiB
#include <bits/stdc++.h> #define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define co cout<< //#pragma GCC optimize("O3,Ofast,unroll-loops") //#pragma GCC target("avx2,sse3,sse4,avx") using namespace std; //stuff void solve(){ ll n; cin>>n; ll ans=1; string s[n+5]; for(int i=0;i<n;i++){ cin>>s[i]; sort(s[i].begin(),s[i].end()); } sort(s,s+n); for(int i=0;i<n;i++){ if(i==0) ans+=s[i].size(); else{ ll last=-1; for(int j=0;j<s[i-1].size();j++){ if(s[i][j]!=s[i-1][j]) break; last=j; } ans+=s[i].size()-(last+1); } } co ans; } int main() { suiii int _=1; // cin>>_; while(_--) solve(); return 0; }

Compilation message (stderr)

vjestica.cpp: In function 'void solve()':
vjestica.cpp:25:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             for(int j=0;j<s[i-1].size();j++){
      |                         ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...