QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#253080 | #7217. Welcome to ICPCCamp 2016! | SolitaryDream# | WA | 422ms | 19856kb | C++17 | 957b | 2023-11-16 17:24:28 | 2023-11-16 17:24:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2017;
bitset<N> f[N], nf, delta;
int g[N][N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n = 6666;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
// a[i] = rand() % 2016;
a[i] %= 2016;
}
f[0][0] = 1;
for (int pid = 0; pid < n; ++pid) {
int x = a[pid];
for (int i = 2016; i; --i) {
nf = (f[i - 1] << x) | (f[i - 1] >> (2016 - x));
delta = nf ^ f[i];
f[i] = nf;
for (int j = delta._Find_first(); j < N; j = delta._Find_next(j)) g[i][j] = pid;
}
if (f[2016][0]) {
for (int j = 2016, rm = 0; j; --j) {
int x = g[j][rm];
rm = (rm - a[x] + 2016) % 2016;
cout << x + 1 << '\n';
}
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 211ms
memory: 19044kb
input:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2001 2000 1999 1998 1997 1996 1995 1994 1993 1992 1991 1990 1989 1988 1987 1986 1985 1984 1983 1982 1981 1980 1979 1978 1977 1976 1975 1974 1973 1972 1971 1970 1969 1968 1967 1966 1965 1964 1963 1962 1961 1960 1959 1958 1957 ...
result:
ok
Test #2:
score: -100
Wrong Answer
time: 422ms
memory: 19856kb
input:
594 1354 212 1769 1821 1476 290 663 856 1604 1886 995 1449 999 1485 1744 1765 422 672 1496 168 1457 400 1555 1881 1875 385 881 1321 1907 1729 1277 1074 78 1703 634 1913 1440 182 487 1773 474 1977 1085 1384 1674 1958 1709 1099 1112 1661 68 1731 1093 264 360 40 1163 635 345 762 1761 562 627 1956 1558 ...
output:
2084 2084 1 1 1 1 1 2052 1 1 1 1 1 2080 1 1 1 1 1 1 1 1 2079 1 1 1 1 2071 1 1 1 1 1 1 1999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1949 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2059 1 1 1 1 1 1 1 1 1 1982 1 1 2065 1 1 1 1 2084 2084 1 1 1 1 1 1 1 1934 1 1 1 1 1 1 1 ...
result:
wrong answer duplicated indices