Submission #1117181

# Submission time Handle Problem Language Result Execution time Memory
1117181 2024-11-22T21:32:00 Z StefanSebez PIN (CEOI10_pin) C++14
60 / 100
415 ms 16456 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
const int N=50050;
int main(){
    int n,D;scanf("%i%i",&n,&D);
    string s[n+10];for(int i=0;i<n;i++) cin>>s[i];
    ll res=0;
    map<string,ll>mapa;
    for(int i=0;i<n;i++){
		for(int mask=0;mask<16;mask++){
			string t=s[i];int ct=0;
			for(int j=0;j<4;j++){
				if((mask>>j)&1) t[j]='?',ct++;
			}
			if(ct>D) continue;
			if(D%2==ct%2) res+=mapa[t];
			else res-=mapa[t];
		}
		for(int mask=0;mask<16;mask++){
			string t=s[i];
			for(int j=0;j<4;j++){
				if((mask>>j)&1) t[j]='?';
			}
			mapa[t]++;
		}
    }
    printf("%lld\n",res);
    return 0;
}

Compilation message

pin.cpp: In function 'int main()':
pin.cpp:10:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     int n,D;scanf("%i%i",&n,&D);
      |             ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1120 KB Output is correct
2 Incorrect 8 ms 1104 KB Output isn't correct
3 Correct 6 ms 848 KB Output is correct
4 Correct 104 ms 3936 KB Output is correct
5 Correct 132 ms 4644 KB Output is correct
6 Incorrect 139 ms 4424 KB Output isn't correct
7 Incorrect 106 ms 3908 KB Output isn't correct
8 Correct 105 ms 4868 KB Output is correct
9 Correct 187 ms 6728 KB Output is correct
10 Incorrect 244 ms 7348 KB Output isn't correct
11 Incorrect 134 ms 4708 KB Output isn't correct
12 Incorrect 251 ms 6980 KB Output isn't correct
13 Incorrect 148 ms 5192 KB Output isn't correct
14 Correct 144 ms 4712 KB Output is correct
15 Correct 279 ms 7148 KB Output is correct
16 Correct 217 ms 12216 KB Output is correct
17 Incorrect 363 ms 16364 KB Output isn't correct
18 Correct 314 ms 13384 KB Output is correct
19 Correct 346 ms 15032 KB Output is correct
20 Correct 415 ms 16456 KB Output is correct