# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
803132 | Augustyn | Set (COCI21_set) | C++17 | 1082 ms | 38264 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<iostream>
#include<vector>
using namespace std;
int trzecia(vector<char>&p,vector<char>&d)
{
int ret=0;
for(int i=0;i<p.size();++i)
{
if(p[i]==d[i])
ret=ret*3+p[i]-'1';
else
ret=ret*3+((p[i]-'0')^(d[i]-'0'))-1;
}
return ret;
}
int main()
{
ios_base::sync_with_stdio(0);
int n,k,odp=0;
cin>>n>>k;
vector<vector<char>>wek(n);
int doktej=1;
for(int i=1;i<=k;++i)
doktej*=3;
vector<int>istnieje(doktej,-1);
for(int i=0;i<n;++i)
{
wek[i].resize(k);
int wtroj=0;
for(int j=0;j<k;++j)
{
cin>>wek[i][j];
wtroj=wtroj*3+wek[i][j]-'1';
}
istnieje[wtroj]=i;
}
for(int i=0;i<n/2;++i)
{
for(int j=i+1;j<n/2;++j)
{
int pom=istnieje[trzecia(wek[i],wek[j])];
if(pom>j)
++odp;
}
}
for(int i=n/2;i<n;++i)
{
for(int j=i+1;j<n;++j)
{
int pom=istnieje[trzecia(wek[i],wek[j])];
if(pom!=-1&&pom<n/2||pom>j)
++odp;
}
}
cout<<odp;
}
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... |