# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72687 | 2018-08-26T15:12:44 Z | gs14004 | Judge Against Wrong Code (FXCUP3_judge) | C++17 | 716 ms | 148024 KB |
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef long double llf; typedef pair<int, int> pi; const int MAXN = 1050000; int m, n1, n2, a[MAXN], b[MAXN]; char buf[22]; int getMask(){ scanf("%s",buf); int ans = 0; for(int i=0; buf[i]; i++){ if(buf[i] != '.') ans |= (1<<i); } return ans; } int dp[MAXN]; int func[MAXN], clos[MAXN], cnt[MAXN], ret[MAXN]; using base = int; void fft(vector<base> &a, bool inv){ int n = a.size(), j = 0; for(int i=1; i<n; i++){ int bit = (n >> 1); while(j >= bit){ j -= bit; bit >>= 1; } j += bit; if(i < j) swap(a[i], a[j]); } for(int i=2; i<=n; i<<=1){ // int step = n / i; for(int j=0; j<n; j+=i){ for(int k=0; k<i/2; k++){ base u = a[j+k], v = a[j+k+i/2]; a[j+k] = u; if(!inv) a[j+k+i/2] = u+v; else a[j+k+i/2] = v -u; } } } } void convolute(){ vector<int> ans; for(int i=0; i<(1<<m); i++){ ans.push_back(clos[i]); } fft(ans, 0); for(int i=0; i<(1<<m); i++) ans[i] *= ans[i]; fft(ans, 1); for(int i=0; i<(1<<m); i++) clos[i] = ans[i]; } void make_or_closure(){ for(int i=0; i<5; i++){ convolute(); for(int j=0; j<(1<<m); j++) clos[j] = min(clos[j], 1); } } int main(){ scanf("%d",&m); scanf("%d",&n1); for(int i=0; i<n1; i++){ a[i] = getMask(); clos[a[i]] = 1; } clos[0] = 1; make_or_closure(); scanf("%d",&n2); for(int i=0; i<n2; i++){ cnt[getMask()]++; } for(int i=0; i<m; i++){ for(int j=0; j<(1<<m); j++){ if((j >> i) & 1){ cnt[j] += cnt[j ^ (1<<i)]; } } } for(int j=0; j<(1<<m); j++){ int func = n2 - cnt[((1<<m) - 1) ^ j]; if(clos[j]) ret[func] = 1; } for(int i=1; i<=n2; i++) putchar(ret[i] ? 'o' : 'x'); puts(""); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 492 KB | Output is correct |
3 | Correct | 3 ms | 492 KB | Output is correct |
4 | Correct | 12 ms | 988 KB | Output is correct |
5 | Correct | 11 ms | 988 KB | Output is correct |
6 | Correct | 11 ms | 1104 KB | Output is correct |
7 | Correct | 12 ms | 1104 KB | Output is correct |
8 | Correct | 12 ms | 1104 KB | Output is correct |
9 | Correct | 12 ms | 1120 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 492 KB | Output is correct |
3 | Correct | 3 ms | 492 KB | Output is correct |
4 | Correct | 12 ms | 988 KB | Output is correct |
5 | Correct | 11 ms | 988 KB | Output is correct |
6 | Correct | 11 ms | 1104 KB | Output is correct |
7 | Correct | 12 ms | 1104 KB | Output is correct |
8 | Correct | 12 ms | 1104 KB | Output is correct |
9 | Correct | 12 ms | 1120 KB | Output is correct |
10 | Correct | 56 ms | 4176 KB | Output is correct |
11 | Correct | 68 ms | 9652 KB | Output is correct |
12 | Correct | 15 ms | 9652 KB | Output is correct |
13 | Correct | 13 ms | 9652 KB | Output is correct |
14 | Correct | 124 ms | 19056 KB | Output is correct |
15 | Correct | 113 ms | 25504 KB | Output is correct |
16 | Correct | 187 ms | 43040 KB | Output is correct |
17 | Correct | 210 ms | 58712 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 492 KB | Output is correct |
3 | Correct | 3 ms | 492 KB | Output is correct |
4 | Correct | 12 ms | 988 KB | Output is correct |
5 | Correct | 11 ms | 988 KB | Output is correct |
6 | Correct | 11 ms | 1104 KB | Output is correct |
7 | Correct | 12 ms | 1104 KB | Output is correct |
8 | Correct | 12 ms | 1104 KB | Output is correct |
9 | Correct | 12 ms | 1120 KB | Output is correct |
10 | Correct | 56 ms | 4176 KB | Output is correct |
11 | Correct | 68 ms | 9652 KB | Output is correct |
12 | Correct | 15 ms | 9652 KB | Output is correct |
13 | Correct | 13 ms | 9652 KB | Output is correct |
14 | Correct | 124 ms | 19056 KB | Output is correct |
15 | Correct | 113 ms | 25504 KB | Output is correct |
16 | Correct | 187 ms | 43040 KB | Output is correct |
17 | Correct | 210 ms | 58712 KB | Output is correct |
18 | Correct | 193 ms | 70432 KB | Output is correct |
19 | Correct | 263 ms | 83240 KB | Output is correct |
20 | Correct | 600 ms | 94572 KB | Output is correct |
21 | Correct | 437 ms | 110184 KB | Output is correct |
22 | Correct | 571 ms | 127468 KB | Output is correct |
23 | Correct | 716 ms | 148024 KB | Output is correct |