| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 888550 | Mr_Ph | Set (COCI21_set) | C++17 | 6 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<x, null_type,
ll mod=(ll)1e9+7;
ll mod1=998244353;
///the defines :)
#define endl '\n'
#define vi vector<int>
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
#define int long long
void preprocess() {}
void solve()
{
int n,kk;
cin>>n>>kk;
vector<string>arr(n);
ent(arr);
int cnt=0;
map<string,int>mp;
for(auto i:arr)mp[i]++;
for(int i=0;i<n;i++)
{
mp[arr[i]]--;
for(int j=i+1;j<n;j++)
{
mp[arr[j]]--;
string s;
bool valid=true;
for(int o=0;o<kk;o++)
{
if(arr[i][o]==arr[j][o])s+=arr[i][o];
else
{
char x=min(arr[i][o],arr[j][o]),y=max(arr[i][o],arr[j][o]);
if(x=='1'&&y=='2')s+='3';
else if(x=='2'&&y=='3')s+='1';
else if(x=='1'&&y=='3')s+='2';
}
}
// cout<<s<<endl;
cnt+=mp[s];
}
}
cout<<cnt<<endl;
}
signed main()
{
// freopen("meta_game_input.txt","r",stdin);
// freopen("otput.txt","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
preprocess();
int t=1,st;
// cin>>t;
while(t--)
solve();
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
