| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 224802 | MKopchev | PIN (CEOI10_pin) | C++14 | 605 ms | 20472 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int hsh(char c)
{
if('0'<=c&&c<='9')return c-'0';
return c-'a'+10;
}
bool valid(char c)
{
if('0'<=c&&c<='9')return 1;
if('a'<=c&&c<='z')return 1;
return 0;
}
const int nmax=5e4+42;
vector<int> in;
long long output[5];
map< vector<int>, int> seen;
int n,want;
int main()
{
scanf("%i%i",&n,&want);
for(int i=1;i<=n;i++)
{
in={};
for(int j=1;j<=4;j++)
{
char c=getchar();
while(valid(c)==0)c=getchar();
int val=hsh(c);
in.push_back(val);
}
for(int mask=0;mask<(1<<4);mask++)
{
int other=0;
vector<int> help={};
for(int j=0;j<4;j++)
if((mask&(1<<j)))help.push_back(in[j]);
else {help.push_back(-1);other++;}
output[other]+=seen[help];
seen[help]++;
}
}
//cout<<output[0]<<" "<<output[1]<<" "<<output[2]<<" "<<output[3]<<" "<<output[4]<<endl;
output[2]=output[2]-3*output[1];
output[3]=output[3]-3*output[1]-2*output[2];
output[4]=1LL*n*(n-1)/2-output[0]-output[1]-output[2]-output[3];
//cout<<output[0]<<" "<<output[1]<<" "<<output[2]<<" "<<output[3]<<" "<<output[4]<<endl;
printf("%lld\n",output[want]);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
