# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
575751 | 2022-06-11T08:48:10 Z | AGE | Transport (COCI19_transport) | C++14 | 88 ms | 64820 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=1e6,M=2e3,mod=1e9+7; string s[N]; map<string,int>mp; int cnt[N][27],cnttt[N]; main() { int n,m; cin>>n>>m; for(int i=0;i<n;i++) cin>>s[i]; int ans=n*(n-1); for(int i=0;i<n;i++){ if(s[i][0]!='?') cnt[0][s[i][0]-'a']++; if(s[i][1]!='?') cnt[1][s[i][1]-'a']++; } int sum0=0; for(int i=0;i<26;i++) sum0+=cnt[0][i]; for(int i=0;i<n;i++) if(s[i][0]!='?') ans-=(sum0-cnt[0][s[i][0]-'a']); int sum1=0; for(int i=0;i<26;i++) sum1+=cnt[1][i]; for(int i=0;i<n;i++) if(s[i][1]!='?') ans-=(sum1-cnt[1][s[i][1]-'a']); int cntt=0; for(int i=0;i<n;i++){ cntt++; cnttt[(s[i][0]-'a')+((s[i][1]-'a')*31)]++; } for(int i=0;i<n;i++){ if(s[i][0]=='?'||s[i][1]=='?') continue; for(char x='a';x<='z';x++){ int xx=x-'a'; for(char y='a';y<='z';y++){ xx+=(y-'a')*31; if(x!=s[i][0]&&y!=s[i][1]){ ans+=cnttt[xx]; } xx-=(y-'a')*31; } } } cout<<ans/2<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 42 ms | 63956 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 43 ms | 63944 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 53 ms | 64320 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 56 ms | 64488 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 63 ms | 64624 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 48 ms | 64196 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 56 ms | 64288 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 61 ms | 64448 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 88 ms | 64600 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 73 ms | 64820 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |