# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598332 | 2022-07-18T05:16:45 Z | AGE | Parametriziran (COCI19_parametriziran) | C++14 | 630 ms | 10368 KB |
#include<bits/stdc++.h> #define F first #define S second #define int long long #define pb push_back using namespace std; const int N=2e5+10,M=2e3,mod=1e9+7; string s[N]; map<string,int>mp; int ans=0; void doo1char(int index){ string z; for(int i=0;i<26;i++){ char x=i+'a'; z=x; z+=s[index][1]; if(s[index][1]!='?') ans+=mp[z]; z=x; z+='?'; ans+=mp[z]; } } void doochar1(int index){ string z; for(int i=0;i<26;i++){ char x=i+'a'; z=s[index][0]; z+=x; if(s[index][0]!='?') ans+=mp[z]; z='?'; z+=x; ans+=mp[z]; } } void doo11(int index){ string z; for(int i=0;i<26;i++){ for(int j=0;j<26;j++){ char x=i+'a'; char y=j+'a'; z=x; z+=y; ans+=mp[z]; } } } main() { int n,m; cin>>n>>m; for(int i=0;i<n;i++) cin>>s[i]; for(int i=0;i<n;i++){ if(s[i][0]=='?'){ doo1char(i); } if(s[i][1]=='?'){ doochar1(i); } if(s[i][1]=='?'&&s[i][0]=='?'){ doo11(i); ans+=mp[s[i]]; mp[s[i]]++; continue; } if(s[i][0]!='?'&&s[i][1]!='?'){ string z; z=s[i][0]; z+='?'; ans+=mp[z]; z='?'; z+=s[i][1]; ans+=mp[z]; } string z; z+='?'; z+='?'; ans+=mp[z]; mp[s[i]]++; } cout<<ans<<endl; return 0; } /* 8 1 2 2 3 2 4 4 5 2 6 6 7 7 8 1 4 3 6 7 8 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 6484 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 67 ms | 6612 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 172 ms | 6592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 125 ms | 7540 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 630 ms | 7276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 201 ms | 9932 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 317 ms | 9184 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 130 ms | 9820 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 144 ms | 9032 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 335 ms | 10368 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |