Submission #224802

#TimeUsernameProblemLanguageResultExecution timeMemory
224802MKopchevPIN (CEOI10_pin)C++14
100 / 100
605 ms20472 KiB
#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; }

Compilation message (stderr)

pin.cpp: In function 'int main()':
pin.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%i",&n,&want);
     ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...