# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
803134 | Augustyn | Set (COCI21_set) | C++17 | 1088 ms | 48088 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<int>&p,vector<int>&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]^d[i])-1;
}
return ret;
}
int main()
{
ios_base::sync_with_stdio(0);
int n,k,odp=0;
cin>>n>>k;
vector<vector<int>>wek(n);
char wcz;
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>>wcz;
wek[i][j]=wcz-'0';
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... |