QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#132517 | #6570. Who Watches the Watchmen? | Sorting | WA | 621ms | 29952kb | C++23 | 10.6kb | 2023-07-30 04:23:40 | 2023-07-30 04:23:45 |
Judging History
answer
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
typedef long long ll;
template<class T> void check_min(T &a, const T &b){ a = (a < b) ? a : b; }
template<class T> void check_max(T &a, const T &b){ a = (a > b) ? a : b; }
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int N = 1000 + 3;
const ll INF = numeric_limits<ll>::max() / 4;
typedef vector<ll> VL;
struct MCMF {
int N;
vector<vi> ed, red;
vector<VL> cap, flow, cost;
vi seen;
VL dist, pi;
vector<pii> par;
MCMF(int N) :
N(N), ed(N), red(N), cap(N, VL(N)), flow(cap), cost(cap),
seen(N), dist(N), pi(N), par(N) {}
void addEdge(int from, int to, ll cap, ll cost) {
this->cap[from][to] = cap;
this->cost[from][to] = cost;
ed[from].push_back(to);
red[to].push_back(from);
}
void path(int s) {
fill(all(seen), 0);
fill(all(dist), INF);
dist[s] = 0; ll di;
__gnu_pbds::priority_queue<pair<ll, int>> q;
vector<decltype(q)::point_iterator> its(N);
q.push({0, s});
auto relax = [&](int i, ll cap, ll cost, int dir) {
ll val = di - pi[i] + cost;
if (cap && val < dist[i]) {
dist[i] = val;
par[i] = {s, dir};
if (its[i] == q.end()) its[i] = q.push({-dist[i], i});
else q.modify(its[i], {-dist[i], i});
}
};
while (!q.empty()) {
s = q.top().second; q.pop();
seen[s] = 1; di = dist[s] + pi[s];
for (int i : ed[s]) if (!seen[i])
relax(i, cap[s][i] - flow[s][i], cost[s][i], 1);
for (int i : red[s]) if (!seen[i])
relax(i, flow[i][s], -cost[i][s], 0);
}
rep(i,0,N) pi[i] = min(pi[i] + dist[i], INF);
}
pair<ll, ll> maxflow(int s, int t) {
ll totflow = 0, totcost = 0;
while (path(s), seen[t]) {
ll fl = INF;
for (int p,r,x = t; tie(p,r) = par[x], x != s; x = p)
fl = min(fl, r ? cap[p][x] - flow[p][x] : flow[x][p]);
totflow += fl;
for (int p,r,x = t; tie(p,r) = par[x], x != s; x = p)
if (r) flow[p][x] += fl;
else flow[x][p] -= fl;
}
rep(i,0,N) rep(j,0,N) totcost += cost[i][j] * flow[i][j];
return {totflow, totcost};
}
// If some costs can be negative, call this before maxflow:
void setpi(int s) { // (otherwise, leave this out)
fill(all(pi), INF); pi[s] = 0;
int it = N, ch = 1; ll v;
while (ch-- && it--)
rep(i,0,N) if (pi[i] != INF)
for (int to : ed[i]) if (cap[i][to])
if ((v = pi[i] + cost[i][to]) < pi[to])
pi[to] = v, ch = 1;
assert(it >= 0); // negative cost cycle
}
};
MCMF *mcmf = nullptr;
template<class T> struct Point3D {
typedef Point3D P;
typedef const P& R;
T x, y, z;
explicit Point3D(T x=0, T y=0, T z=0) : x(x), y(y), z(z) {}
bool operator<(R p) const {
return tie(x, y, z) < tie(p.x, p.y, p.z); }
bool operator==(R p) const {
return tie(x, y, z) == tie(p.x, p.y, p.z); }
P operator+(R p) const { return P(x+p.x, y+p.y, z+p.z); }
P operator-(R p) const { return P(x-p.x, y-p.y, z-p.z); }
P operator*(T d) const { return P(x*d, y*d, z*d); }
P operator/(T d) const { return P(x/d, y/d, z/d); }
T dot(R p) const { return x*p.x + y*p.y + z*p.z; }
P cross(R p) const {
return P(y*p.z - z*p.y, z*p.x - x*p.z, x*p.y - y*p.x);
}
T dist2() const { return x*x + y*y + z*z; }
double dist() const { return sqrt((double)dist2()); }
//Azimuthal angle (longitude) to x-axis in interval [-pi, pi]
double phi() const { return atan2(y, x); }
//Zenith angle (latitude) to the z-axis in interval [0, pi]
double theta() const { return atan2(sqrt(x*x+y*y),z); }
P unit() const { return *this/(T)dist(); } //makes dist()=1
//returns unit vector normal to *this and p
P normal(P p) const { return cross(p).unit(); }
//returns point rotated 'angle' radians ccw around axis
P rotate(double angle, P axis) const {
double s = sin(angle), c = cos(angle); P u = axis.unit();
return u*dot(u)*(1-c) + (*this)*c - cross(u)*s;
}
};
typedef Point3D<ll> P;
int n;
P p[N], v[N];
bool on_line(P a, P b, P c){
return (b - a).cross(c - a) == P();
}
bool same_direction(P a, P b){
return a.dot(b) > 0ll;
}
ll get_sign(P a, P dir_a, P b, P dir_b){
P n2 = dir_b.cross(dir_a.cross(dir_b));
ll sign_1 = (b - a).dot(n2);
sign_1 = (sign_1 > 0) - (sign_1 < 0);
sign_1 *= dir_a.dot(n2);
sign_1 = (sign_1 > 0) - (sign_1 < 0);
return sign_1;
}
bool intersect(P a, P dir_a, P b, P dir_b){
P n = dir_a.cross(dir_b);
if(n == P())
return false;
if((b - a).dot(n) != 0)
return false;
ll sign_1 = get_sign(a, dir_a, b, dir_b);
ll sign_2 = get_sign(b, dir_b, a, dir_a);
return (sign_1 > 0) && (sign_2 > 0);
}
bool b[N][N];
int points_to[N];
vector<vi> adj;
vi btoa;
void solve(){
for(int i = 0; i < n; ++i){
for(int j = i + 1; j < n; ++j){
bool ok = true;
for(int j2 = 0; j2 < n; ++j2){
if(j2 == i || j2 == j) continue;
if(on_line(p[i], p[j], p[j2]) && same_direction(p[j2] - p[i], p[j] - p[j2])){
ok = false;
break;
}
}
b[i][j] = b[j][i] = ok;
}
}
for(int i = 0; i < n; ++i){
points_to[i] = -1;
for(int j = 0; j < n; ++j){
if(i == j) continue;
if(!b[i][j]) continue;
if(on_line(p[i], p[j], p[i] + v[i]) && same_direction(v[i], p[j] - p[i])){
points_to[i] = j;
break;
}
}
}
mcmf = new MCMF(2 * n + 2);
adj.resize(n);
btoa.resize(n, -1);
for(int i = 0; i < n; ++i){
if(points_to[i] != -1){
mcmf->addEdge(i, n + points_to[i], 1, 0);
}
for(int j = 0; j < n; ++j){
if(j != i && j != points_to[i])
mcmf->addEdge(i, n + j, 1, 1);
}
mcmf->addEdge(2 * n, i, 1, 0);
mcmf->addEdge(i + n, 2 * n + 1, 1, 0);
}
cout << mcmf->maxflow(2 * n, 2 * n + 1).second << "\n";
}
ll calc_two_guys(P p0, P v0, P p1, P v1){
ll add = 2;
add -= on_line(p0, p1, p0 + v0) && same_direction(p1 - p0, v0);
add -= on_line(p1, p0, p1 + v1) && same_direction(p0 - p1, v1);
return add;
}
ll prefix[N], suffix[N];
ll solve_line(const vector<P> &p, const vector<P> &v, P v_chosen){
for(int j = 0; j + 1 < v.size(); j += 2){
prefix[j + 2] = calc_two_guys(p[j], v[j], p[j + 1], v[j + 1]) + prefix[j];
}
suffix[(int)v.size() - 1] = 0;
for(int j = (int)v.size() - 1; j - 1 > 0; j -= 2){
suffix[j - 2] = calc_two_guys(p[j], v[j], p[j - 1], v[j - 1]) + suffix[j];
}
ll real_ans = 1000;
for(int i = 0; i < v.size(); i += 2){
ll curr = 0;
ll cnt_in_dir = 0, cnt_not = 0;
for(int j = i + 1; j < v.size(); j += 2){
int l, r;
if(j == i + 1){
l = j - 1;
r = j - 1;
}
else{
l = j - 2;
r = j - 1;
}
for(int j2 = l; j2 <= r; ++j2){
if(on_line(p[0], p[1], p[0] + v[j2]) && same_direction(v[j2], p[1] - p[0])){
++cnt_in_dir;
}
else{
++cnt_not;
}
}
bool d_chosen = !on_line(p[0], p[1], p[0] + v_chosen);
bool d_back = !on_line(p[0], p[1], p[0] + v[j]);
ll ans = cnt_not;
if(d_chosen && d_back){
if(!intersect(p[j], v[j], p[i], P()-v_chosen))
++ans;
}
else{
if(d_chosen || d_back){
++ans;
}
else{
ans += 2;
}
}
ans += prefix[i];
ans += suffix[j];
check_min(real_ans, ans);
}
}
return real_ans;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i = 0; i < n; ++i){
cin >> p[i].x >> p[i].y >> p[i].z;
cin >> v[i].x >> v[i].y >> v[i].z;
}
if(n == 1){
cout << "-1\n";
return 0;
}
bool one_line = true;
for(int i = 2; i < n; ++i)
one_line &= on_line(p[0], p[1], p[i]);
if(one_line){
if(n % 2 == 0){
vector<pair<P, P>> new_points;
for(int j = 0; j < n; ++j){
new_points.push_back({p[j], v[j]});
}
sort(all(new_points));
ll ans = 0;
for(int i = 0; i < n; i += 2){
ll add = 2;
P p0 = new_points[i].first;
P v0 = new_points[i].second;
P p1 = new_points[i + 1].first;
P v1 = new_points[i + 1].second;
add -= on_line(p0, p1, p0 + v0) && same_direction(p1 - p0, v0);
add -= on_line(p1, p0, p1 + v1) && same_direction(p0 - p1, v1);
ans += add;
}
cout << ans << "\n";
return 0;
}
ll ans = 1000;
for(int chosen = 0; chosen < n; ++chosen){
vector<pair<P, P>> new_points;
for(int j = 0; j < n; ++j){
if(chosen == j) continue;
new_points.push_back({p[j], v[j]});
}
sort(all(new_points));
for(int dir = 0; dir <= 1; ++dir, reverse(all(new_points))){
vector<P> new_p, new_v;
for(int i = 0; i < new_points.size(); ++i){
new_p.push_back(new_points[i].first);
new_v.push_back(new_points[i].second);
}
ll curr = solve_line(new_p, new_v, v[chosen]);
check_min(ans, curr);
}
}
cout << 1000 + ans << "\n";
return 0;
}
solve();
}
/*
3
0 0 0 0 0 1
0 0 1 0 -1 -1
0 0 2 0 0 1
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
input:
7 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 -1 0 0
output:
1002
result:
ok single line: '1002'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
4 66 45 10 73 39 36 95 14 26 47 84 59 14 66 89 89 36 78 16 27 94 79 24 24
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
3 0 0 0 1 0 0 1 1 1 1 0 0 2 2 2 1 0 0
output:
1002
result:
ok single line: '1002'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
3 0 0 0 1 1 1 1 1 1 1 0 0 2 2 2 1 0 0
output:
1001
result:
ok single line: '1001'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
3 0 0 0 1 0 0 1 1 1 1 0 0 2 2 2 -1 -1 -1
output:
1001
result:
ok single line: '1001'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
3 0 0 0 1 0 0 1 1 1 1 2 2 2 2 2 -1 -1 -1
output:
1000
result:
ok single line: '1000'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
3 0 0 0 1 0 0 1 1 1 1 2 2 2 2 2 1 1 1
output:
1001
result:
ok single line: '1001'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
1 0 0 0 3 1 4
output:
-1
result:
ok single line: '-1'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
4 0 0 0 1 1 1 1 0 0 -1 0 0 1 1 1 0 -1 0 1 0 1 0 1 0
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
500 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 -1 0 0 3 0 0 1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 1 0 0 8 0 0 1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0 11 0 0 -1 0 0 12 0 0 1 0 0 13 0 0 -1 0 0 14 0 0 1 0 0 15 0 0 1 0 0 16 0 0 1 0 0 17 0 0 -1 0 0 18 0 0 -1 0 0 19 0 0 -1 0 0 20 0 0 -1 0 0 21 0 0 1 0 0 22 0 0 1 0 0...
output:
250
result:
ok single line: '250'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
500 0 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 -1 0 0 3 0 0 1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 1 0 0 8 0 0 1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0 11 0 0 -1 0 0 12 0 0 1 0 0 13 0 0 -1 0 0 14 0 0 1 0 0 15 0 0 1 0 0 16 0 0 1 0 0 17 0 0 -1 0 0 18 0 0 -1 0 0 19 0 0 -1 0 0 20 0 0 -1 0 0 21 0 0 1 0 0 22 0 0 1 0...
output:
250
result:
ok single line: '250'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
500 0 0 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 -1 0 0 3 0 0 1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 1 0 0 8 0 0 1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0 11 0 0 -1 0 0 12 0 0 1 0 0 13 0 0 -1 0 0 14 0 0 1 0 0 15 0 0 1 0 0 16 0 0 1 0 0 17 0 0 -1 0 0 18 0 0 -1 0 0 19 0 0 -1 0 0 20 0 0 -1 0 0 21 0 0 1 0 0 22 0 0 1...
output:
250
result:
ok single line: '250'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
5 1 0 0 1 -1 0 2 0 0 0 1 0 3 0 0 -1 0 0 4 0 0 -1 0 0 5 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
5 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 0 0 1 0 5 0 0 -1 -1 0
output:
1000
result:
ok single line: '1000'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
6 0 1 0 1 0 0 0 2 0 0 2 0 0 3 0 0 3 0 0 4 0 0 4 0 0 5 0 0 5 0 0 6 0 0 6 0
output:
4
result:
ok single line: '4'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
9 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1
output:
3
result:
ok single line: '3'
Test #17:
score: 0
Accepted
time: 506ms
memory: 3696kb
input:
499 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 -1 0 0 3 0 0 1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 1 0 0 8 0 0 1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0 11 0 0 -1 0 0 12 0 0 1 0 0 13 0 0 -1 0 0 14 0 0 1 0 0 15 0 0 1 0 0 16 0 0 1 0 0 17 0 0 -1 0 0 18 0 0 -1 0 0 19 0 0 -1 0 0 20 0 0 -1 0 0 21 0 0 1 0 0 22 0 0 1 0 0...
output:
1220
result:
ok single line: '1220'
Test #18:
score: 0
Accepted
time: 509ms
memory: 3644kb
input:
499 0 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 -1 0 0 3 0 0 1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 1 0 0 8 0 0 1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0 11 0 0 -1 0 0 12 0 0 1 0 0 13 0 0 -1 0 0 14 0 0 1 0 0 15 0 0 1 0 0 16 0 0 1 0 0 17 0 0 -1 0 0 18 0 0 -1 0 0 19 0 0 -1 0 0 20 0 0 -1 0 0 21 0 0 1 0 0 22 0 0 1 0...
output:
1220
result:
ok single line: '1220'
Test #19:
score: 0
Accepted
time: 531ms
memory: 3668kb
input:
499 0 0 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 -1 0 0 3 0 0 1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 1 0 0 8 0 0 1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0 11 0 0 -1 0 0 12 0 0 1 0 0 13 0 0 -1 0 0 14 0 0 1 0 0 15 0 0 1 0 0 16 0 0 1 0 0 17 0 0 -1 0 0 18 0 0 -1 0 0 19 0 0 -1 0 0 20 0 0 -1 0 0 21 0 0 1 0 0 22 0 0 1...
output:
1220
result:
ok single line: '1220'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
5 0 0 0 0 -1 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 0 1 0 0
output:
1001
result:
ok single line: '1001'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
5 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 0 0 1 0
output:
1001
result:
ok single line: '1001'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
5 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 0 -1 0 3 0 0 1 0 0 4 0 0 -1 0 0
output:
1001
result:
ok single line: '1001'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
5 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 0 -1 0 4 0 0 1 0 0
output:
1001
result:
ok single line: '1001'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
5 0 0 0 1 1 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 0 -1 -1 0
output:
1001
result:
ok single line: '1001'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
5 0 0 0 1 1 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 0 1 1 0
output:
1001
result:
ok single line: '1001'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
5 0 0 0 5 -1 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 0 1 -1 0
output:
1001
result:
ok single line: '1001'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
17 0 0 0 0 0 1 0 1 0 0 0 1 0 2 0 0 0 1 0 3 0 0 0 1 0 4 0 0 0 1 0 -1 0 0 0 1 0 -2 0 0 0 1 0 -3 0 0 0 1 0 -4 0 0 0 1 1 3 0 0 0 1 2 3 0 0 0 1 -1 3 0 0 0 1 -2 3 0 0 0 1 1 -3 0 0 0 1 2 -3 0 0 0 1 -1 -3 0 0 0 1 -2 -3 0 0 0 1
output:
17
result:
ok single line: '17'
Test #28:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
17 0 0 0 0 4 0 0 1 0 0 -1 0 0 2 0 0 -2 0 0 3 0 0 -3 0 0 4 0 0 -4 0 0 -1 0 0 1 0 0 -2 0 0 2 0 0 -3 0 0 3 0 0 -4 0 0 4 0 1 3 0 -1 -3 0 2 3 0 -1 -2 0 -1 3 0 1 -3 0 -2 3 0 2 -3 0 1 -3 0 -1 3 0 2 -3 0 -2 3 0 -1 -3 0 1 3 0 -2 -3 0 2 3 0
output:
10
result:
ok single line: '10'
Test #29:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
17 0 0 0 0 1 0 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 2 -1 0 0 -1 0 0 1 0 0 -2 0 0 1 0 0 -3 0 0 1 0 0 -4 0 0 1 0 1 3 0 -1 0 0 2 3 0 -1 0 0 -1 3 0 -1 0 0 -2 3 0 4 -6 0 1 -3 0 -1 0 0 2 -3 0 -1 0 0 -1 -3 0 -1 0 0 -2 -3 0 2 -1 0
output:
3
result:
ok single line: '3'
Test #30:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
5 0 0 0 1 1 1 0 0 1 0 0 1 0 0 2 0 0 1 0 0 3 0 0 1 0 0 4 0 -1 1
output:
1001
result:
ok single line: '1001'
Test #31:
score: 0
Accepted
time: 621ms
memory: 29952kb
input:
500 -455212 958307 274912 -88656 390687 881409 -498879 -623821 322766 -916023 347922 541726 -594515 -554311 -413504 -881701 -506880 -144667 658945 -503396 791805 314816 -830920 -769486 -200847 845218 468338 -166468 -49854 -287877 -820402 914874 916800 258029 -210000 -296727 702016 -389491 -31529 -52...
output:
499
result:
ok single line: '499'
Test #32:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
3 1000000 -1 -1 -1000000 -999999 -999999 -1 1000000 -1 101 -101 0 100 999899 -1 999999 1000000 999999
output:
1000
result:
ok single line: '1000'
Test #33:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
3 1000000 -1 -1 1000000 999999 999999 -1 1000000 -1 101 -101 0 100 999899 -1 999999 1000000 999999
output:
1001
result:
ok single line: '1001'
Test #34:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
3 1000000 -1 -1 -1000000 -999999 -999999 -1 1000000 -1 101 -101 0 100 999899 -1 -999999 -1000000 -999999
output:
1001
result:
ok single line: '1001'
Test #35:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
3 1000000 -1 -1 1000000 999999 999999 -1 1000000 -1 101 -101 0 100 999899 -1 -999999 -1000000 -999999
output:
1001
result:
ok single line: '1001'
Test #36:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
3 10 -1 -1 -10 -9 -9 -1 10 -1 11 -11 0 21 -12 -1 9 10 9
output:
1000
result:
ok single line: '1000'
Test #37:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
7 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 0 -1 0 3 0 0 1 0 0 4 0 0 -1 1 0 5 0 0 1 0 0 6 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #38:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
7 0 0 0 1 0 0 1 0 0 0 -1 0 2 0 0 -1 0 0 3 0 0 1 0 0 4 0 0 -1 1 0 5 0 0 1 0 0 6 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
7 0 0 0 0 -1 0 1 0 0 1 0 0 2 0 0 -1 0 0 3 0 0 1 0 0 4 0 0 -1 1 0 5 0 0 1 0 0 6 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #40:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
7 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 1 0 4 0 0 0 -1 0 5 0 0 1 0 0 6 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
7 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 1 0 4 0 0 1 0 0 5 0 0 0 -1 0 6 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #42:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
7 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 1 0 4 0 0 1 0 0 5 0 0 -1 0 0 6 0 0 0 -1 0
output:
1000
result:
ok single line: '1000'
Test #43:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 0 1 0 5 0 0 1 -1 0 6 0 0 -1 0 0 7 0 0 -1 0 0 8 0 0 -1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #44:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 1 -1 0 5 0 0 0 1 0 6 0 0 -1 0 0 7 0 0 -1 0 0 8 0 0 -1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #45:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 0 1 0 5 0 0 -1 0 0 6 0 0 1 -1 0 7 0 0 -1 0 0 8 0 0 -1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #46:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 0 1 0 5 0 0 -1 0 0 6 0 0 -1 0 0 7 0 0 1 -1 0 8 0 0 -1 0 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #47:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 -1 -1 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 1 0 0 8 0 0 0 1 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #48:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 1 0 0 5 0 0 -1 -1 0 6 0 0 1 0 0 7 0 0 1 0 0 8 0 0 0 1 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #49:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 -1 -1 0 7 0 0 1 0 0 8 0 0 0 1 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #50:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 -1 -1 0 8 0 0 0 1 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #51:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
11 0 0 0 1 0 0 1 0 0 -1 0 0 2 0 0 1 0 0 3 0 0 -1 0 0 4 0 0 1 0 0 5 0 0 1 0 0 6 0 0 1 0 0 7 0 0 0 1 0 8 0 0 -1 -1 0 9 0 0 1 0 0 10 0 0 -1 0 0
output:
1000
result:
ok single line: '1000'
Test #52:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
27 -1000000 -1000000 -1000000 1000000 0 1000000 -1000000 -1000000 0 -1000000 0 1000000 -1000000 -1000000 1000000 -1000000 0 1000000 -1000000 0 -1000000 1000000 1000000 1000000 -1000000 0 0 0 -1000000 1000000 -1000000 0 1000000 1000000 -1000000 1000000 -1000000 1000000 -1000000 1000000 0 1000000 -100...
output:
17
result:
ok single line: '17'
Test #53:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
500 -999983 -999981 -999977 17 19 23 -999966 -999962 -999954 17 19 23 -999949 -999943 -999931 17 19 23 -999932 -999924 -999908 17 19 23 -999915 -999905 -999885 17 19 23 -999898 -999886 -999862 17 19 23 -999881 -999867 -999839 17 19 23 -999864 -999848 -999816 17 19 23 -999847 -999829 -999793 17 19 23...
output:
250
result:
ok single line: '250'
Test #54:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
500 999983 999981 999977 -17 -19 -23 999966 999962 999954 -17 -19 -23 999949 999943 999931 -17 -19 -23 999932 999924 999908 -17 -19 -23 999915 999905 999885 -17 -19 -23 999898 999886 999862 -17 -19 -23 999881 999867 999839 -17 -19 -23 999864 999848 999816 -17 -19 -23 999847 999829 999793 -17 -19 -23...
output:
250
result:
ok single line: '250'
Test #55:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
500 999686 -999841 999735 -314 159 -265 999372 -999682 999470 -314 159 -265 999058 -999523 999205 314 -159 265 998744 -999364 998940 -314 159 -265 998430 -999205 998675 -314 159 -265 998116 -999046 998410 -314 159 -265 997802 -998887 998145 -314 159 -265 997488 -998728 997880 -314 159 -265 997174 -9...
output:
250
result:
ok single line: '250'
Test #56:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
500 999900 -999800 999700 -100 200 -300 999800 -999600 999400 -100 200 -300 999700 -999400 999100 100 -200 300 999600 -999200 998800 -100 200 -300 999500 -999000 998500 -100 200 -300 999400 -998800 998200 -100 200 -300 999300 -998600 997900 -100 200 -300 999200 -998400 997600 -100 200 -300 999100 -9...
output:
250
result:
ok single line: '250'
Test #57:
score: -100
Wrong Answer
time: 549ms
memory: 28004kb
input:
480 -2402 3028 3274 23 -29 -31 -79 99 143 23 -29 -31 3854 -4860 -5158 -23 29 31 1370 -1728 -1810 -23 29 31 -4127 5203 5599 23 -29 -31 -5461 6885 7397 23 -29 -31 2382 -3004 -3174 -23 29 31 -1965 2477 2685 23 -29 -31 2888 -3642 -3856 -23 29 31 -3782 4768 5134 23 -29 -31 1899 -2395 -2523 -23 29 31 59 -...
output:
2
result:
wrong answer 1st lines differ - expected: '122', found: '2'