QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#253083 | #7217. Welcome to ICPCCamp 2016! | SolitaryDream# | WA | 565ms | 19836kb | C++17 | 1007b | 2023-11-16 17:26:49 | 2023-11-16 17:26:50 |
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]) {
int rm = 0;
for (int j = 2016; j; --j) {
int x = g[j][rm];
rm = (rm - a[x] + 2016) % 2016;
cout << x + 1 << '\n';
}
assert(rm == 0);
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 314ms
memory: 19016kb
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: 565ms
memory: 19836kb
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 2083 2082 2081 2080 2079 2078 2077 2076 2075 2074 2073 2072 2071 2070 2069 2068 2067 2066 2065 2064 2063 2062 2061 2060 2059 2058 2057 2056 2055 2054 2053 2052 2051 2050 2049 2048 2047 2046 2045 2044 2043 2042 2041 2040 2039 2038 2042 2041 2040 2039 2038 2037 2036 2035 2034 2033 2032 2031 2030 ...
result:
wrong answer duplicated indices