Submission #20550

# Submission time Handle Problem Language Result Execution time Memory
20550 2017-02-12T09:43:16 Z admin Can polan into space? (OJUZ11_space) C++14
0 / 100
143 ms 13648 KB
/* CURRENTLY WRONG */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
#include <time.h>
#include <functional>
#include <numeric>
 
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
 
#define debug(format, ...) printf(format, __VA_ARGS__);
 
const int N_ = 200500;
 
int N;
long long V[N_][3];
 
long long tb[N_][3], mx[3];
int tbp[N_][3], mxp[3];
 
long long sum1;
 
int timing[N_];
 
int main() {
  scanf("%d", &N);
  for(int i = 1; i <= N; i++) {
    for(int k = 0; k < 3; k++) {
      scanf("%lld", &V[i][k]);
    }
    sum1 += V[i][1];
    V[i][0] -= V[i][1];
    V[i][2] -= V[i][1];
    V[i][1] = 0;
  }
 
  tb[1][0] = V[1][0];
  tie(mx[0], mxp[0]) = make_pair(tb[1][0], 1);
 
  tb[1][2] = -(ll)1e18;
  tie(mx[2], mxp[2]) = make_pair(tb[1][2], 1);
 
  for(int i = 2; i <= N; i++) {
    tie(tb[i][0], tbp[i][0]) = max(make_pair(mx[2] + V[i][0], mxp[2]), make_pair(V[i][0], 0));
    tie(tb[i][2], tbp[i][2]) = make_pair(mx[0] + V[i][2], mxp[0]);
    for(int k = 0; k < 3; k++) {
      if(mx[k] < tb[i][k])
        tie(mx[k], mxp[k]) = make_pair(tb[i][k], i);
    }
  }

  printf("%lld\n", mx[0]);
  
  fill(timing + 1, timing + N + 1, 1);
  for(int i = mxp[0], s = 0; i > 0; i = tbp[i][s], s = 2 - s) {
    timing[i] = s;
  }

  for(int i = 1; i <= N; i++) {
    if(timing[i] == 0) printf("%d ", i);
  }
  for(int i = 1; i <= N; i++) {
    if(timing[i] == 0) {
      for(int j = i+1; j <= N && timing[j] == 1; j++) printf("%d ", j);
      for(int j = i-1; j > 0 && timing[j] == 1; j--) printf("%d ", j);
    }
  }
  for(int i = 1; i <= N; i++) {
    if(timing[i] == 2) printf("%d ", i);
  }
  
  return 0;
}

Compilation message

space.cpp: In function 'int main()':
space.cpp:48:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &N);
                  ^
space.cpp:51:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%lld", &V[i][k]);
                              ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 13648 KB Output isn't correct
2 Incorrect 0 ms 13648 KB Output isn't correct
3 Incorrect 0 ms 13648 KB Output isn't correct
4 Incorrect 0 ms 13648 KB Output isn't correct
5 Incorrect 0 ms 13648 KB Output isn't correct
6 Incorrect 0 ms 13648 KB Output isn't correct
7 Incorrect 0 ms 13648 KB Output isn't correct
8 Incorrect 0 ms 13648 KB Output isn't correct
9 Incorrect 0 ms 13648 KB Output isn't correct
10 Incorrect 0 ms 13648 KB Output isn't correct
11 Incorrect 0 ms 13648 KB Output isn't correct
12 Incorrect 0 ms 13648 KB Output isn't correct
13 Incorrect 0 ms 13648 KB Output isn't correct
14 Incorrect 0 ms 13648 KB Output isn't correct
15 Incorrect 0 ms 13648 KB Output isn't correct
16 Incorrect 0 ms 13648 KB Output isn't correct
17 Incorrect 0 ms 13648 KB Output isn't correct
18 Incorrect 0 ms 13648 KB Output isn't correct
19 Incorrect 0 ms 13648 KB Output isn't correct
20 Incorrect 0 ms 13648 KB Output isn't correct
21 Incorrect 0 ms 13648 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 13648 KB Output isn't correct
2 Incorrect 0 ms 13648 KB Output isn't correct
3 Incorrect 0 ms 13648 KB Output isn't correct
4 Incorrect 0 ms 13648 KB Output isn't correct
5 Incorrect 0 ms 13648 KB Output isn't correct
6 Incorrect 0 ms 13648 KB Output isn't correct
7 Incorrect 0 ms 13648 KB Output isn't correct
8 Incorrect 0 ms 13648 KB Output isn't correct
9 Incorrect 0 ms 13648 KB Output isn't correct
10 Incorrect 0 ms 13648 KB Output isn't correct
11 Incorrect 0 ms 13648 KB Output isn't correct
12 Incorrect 0 ms 13648 KB Output isn't correct
13 Incorrect 0 ms 13648 KB Output isn't correct
14 Incorrect 0 ms 13648 KB Output isn't correct
15 Incorrect 0 ms 13648 KB Output isn't correct
16 Incorrect 0 ms 13648 KB Output isn't correct
17 Incorrect 0 ms 13648 KB Output isn't correct
18 Incorrect 0 ms 13648 KB Output isn't correct
19 Incorrect 0 ms 13648 KB Output isn't correct
20 Incorrect 0 ms 13648 KB Output isn't correct
21 Incorrect 0 ms 13648 KB Output isn't correct
22 Incorrect 0 ms 13648 KB Output isn't correct
23 Incorrect 0 ms 13648 KB Output isn't correct
24 Incorrect 0 ms 13648 KB Output isn't correct
25 Incorrect 0 ms 13648 KB Output isn't correct
26 Incorrect 0 ms 13648 KB Output isn't correct
27 Incorrect 0 ms 13648 KB Output isn't correct
28 Incorrect 0 ms 13648 KB Output isn't correct
29 Incorrect 0 ms 13648 KB Output isn't correct
30 Incorrect 0 ms 13648 KB Output isn't correct
31 Incorrect 0 ms 13648 KB Output isn't correct
32 Incorrect 0 ms 13648 KB Output isn't correct
33 Incorrect 0 ms 13648 KB Output isn't correct
34 Incorrect 0 ms 13648 KB Output isn't correct
35 Incorrect 0 ms 13648 KB Output isn't correct
36 Incorrect 0 ms 13648 KB Output isn't correct
37 Incorrect 0 ms 13648 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 13648 KB Output isn't correct
2 Incorrect 0 ms 13648 KB Output isn't correct
3 Incorrect 0 ms 13648 KB Output isn't correct
4 Incorrect 0 ms 13648 KB Output isn't correct
5 Incorrect 0 ms 13648 KB Output isn't correct
6 Incorrect 0 ms 13648 KB Output isn't correct
7 Incorrect 0 ms 13648 KB Output isn't correct
8 Incorrect 0 ms 13648 KB Output isn't correct
9 Incorrect 0 ms 13648 KB Output isn't correct
10 Incorrect 0 ms 13648 KB Output isn't correct
11 Incorrect 0 ms 13648 KB Output isn't correct
12 Incorrect 0 ms 13648 KB Output isn't correct
13 Incorrect 0 ms 13648 KB Output isn't correct
14 Incorrect 0 ms 13648 KB Output isn't correct
15 Incorrect 0 ms 13648 KB Output isn't correct
16 Incorrect 0 ms 13648 KB Output isn't correct
17 Incorrect 0 ms 13648 KB Output isn't correct
18 Incorrect 0 ms 13648 KB Output isn't correct
19 Incorrect 0 ms 13648 KB Output isn't correct
20 Incorrect 0 ms 13648 KB Output isn't correct
21 Incorrect 0 ms 13648 KB Output isn't correct
22 Incorrect 0 ms 13648 KB Output isn't correct
23 Incorrect 0 ms 13648 KB Output isn't correct
24 Incorrect 0 ms 13648 KB Output isn't correct
25 Incorrect 0 ms 13648 KB Output isn't correct
26 Incorrect 0 ms 13648 KB Output isn't correct
27 Incorrect 0 ms 13648 KB Output isn't correct
28 Incorrect 0 ms 13648 KB Output isn't correct
29 Incorrect 0 ms 13648 KB Output isn't correct
30 Incorrect 0 ms 13648 KB Output isn't correct
31 Incorrect 0 ms 13648 KB Output isn't correct
32 Incorrect 0 ms 13648 KB Output isn't correct
33 Incorrect 0 ms 13648 KB Output isn't correct
34 Incorrect 0 ms 13648 KB Output isn't correct
35 Incorrect 0 ms 13648 KB Output isn't correct
36 Incorrect 0 ms 13648 KB Output isn't correct
37 Incorrect 0 ms 13648 KB Output isn't correct
38 Incorrect 0 ms 13648 KB Output isn't correct
39 Incorrect 0 ms 13648 KB Output isn't correct
40 Incorrect 0 ms 13648 KB Output isn't correct
41 Incorrect 0 ms 13648 KB Output isn't correct
42 Incorrect 0 ms 13648 KB Output isn't correct
43 Incorrect 0 ms 13648 KB Output isn't correct
44 Incorrect 0 ms 13648 KB Output isn't correct
45 Incorrect 0 ms 13648 KB Output isn't correct
46 Incorrect 0 ms 13648 KB Output isn't correct
47 Incorrect 0 ms 13648 KB Output isn't correct
48 Incorrect 0 ms 13648 KB Output isn't correct
49 Incorrect 0 ms 13648 KB Output isn't correct
50 Incorrect 0 ms 13648 KB Output isn't correct
51 Incorrect 0 ms 13648 KB Output isn't correct
52 Incorrect 0 ms 13648 KB Output isn't correct
53 Incorrect 0 ms 13648 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 13648 KB Output isn't correct
2 Incorrect 0 ms 13648 KB Output isn't correct
3 Incorrect 0 ms 13648 KB Output isn't correct
4 Incorrect 0 ms 13648 KB Output isn't correct
5 Incorrect 0 ms 13648 KB Output isn't correct
6 Incorrect 0 ms 13648 KB Output isn't correct
7 Incorrect 0 ms 13648 KB Output isn't correct
8 Incorrect 0 ms 13648 KB Output isn't correct
9 Incorrect 0 ms 13648 KB Output isn't correct
10 Incorrect 0 ms 13648 KB Output isn't correct
11 Incorrect 0 ms 13648 KB Output isn't correct
12 Incorrect 0 ms 13648 KB Output isn't correct
13 Incorrect 0 ms 13648 KB Output isn't correct
14 Incorrect 0 ms 13648 KB Output isn't correct
15 Incorrect 0 ms 13648 KB Output isn't correct
16 Incorrect 0 ms 13648 KB Output isn't correct
17 Incorrect 0 ms 13648 KB Output isn't correct
18 Incorrect 0 ms 13648 KB Output isn't correct
19 Incorrect 0 ms 13648 KB Output isn't correct
20 Incorrect 0 ms 13648 KB Output isn't correct
21 Incorrect 0 ms 13648 KB Output isn't correct
22 Incorrect 0 ms 13648 KB Output isn't correct
23 Incorrect 0 ms 13648 KB Output isn't correct
24 Incorrect 0 ms 13648 KB Output isn't correct
25 Incorrect 0 ms 13648 KB Output isn't correct
26 Incorrect 0 ms 13648 KB Output isn't correct
27 Incorrect 0 ms 13648 KB Output isn't correct
28 Incorrect 0 ms 13648 KB Output isn't correct
29 Incorrect 0 ms 13648 KB Output isn't correct
30 Incorrect 0 ms 13648 KB Output isn't correct
31 Incorrect 0 ms 13648 KB Output isn't correct
32 Incorrect 0 ms 13648 KB Output isn't correct
33 Incorrect 0 ms 13648 KB Output isn't correct
34 Incorrect 0 ms 13648 KB Output isn't correct
35 Incorrect 0 ms 13648 KB Output isn't correct
36 Incorrect 0 ms 13648 KB Output isn't correct
37 Incorrect 0 ms 13648 KB Output isn't correct
38 Incorrect 0 ms 13648 KB Output isn't correct
39 Incorrect 0 ms 13648 KB Output isn't correct
40 Incorrect 0 ms 13648 KB Output isn't correct
41 Incorrect 0 ms 13648 KB Output isn't correct
42 Incorrect 0 ms 13648 KB Output isn't correct
43 Incorrect 0 ms 13648 KB Output isn't correct
44 Incorrect 0 ms 13648 KB Output isn't correct
45 Incorrect 0 ms 13648 KB Output isn't correct
46 Incorrect 0 ms 13648 KB Output isn't correct
47 Incorrect 0 ms 13648 KB Output isn't correct
48 Incorrect 0 ms 13648 KB Output isn't correct
49 Incorrect 0 ms 13648 KB Output isn't correct
50 Incorrect 0 ms 13648 KB Output isn't correct
51 Incorrect 0 ms 13648 KB Output isn't correct
52 Incorrect 0 ms 13648 KB Output isn't correct
53 Incorrect 0 ms 13648 KB Output isn't correct
54 Incorrect 0 ms 13648 KB Output isn't correct
55 Incorrect 6 ms 13648 KB Output isn't correct
56 Incorrect 6 ms 13648 KB Output isn't correct
57 Incorrect 6 ms 13648 KB Output isn't correct
58 Incorrect 6 ms 13648 KB Output isn't correct
59 Incorrect 6 ms 13648 KB Output isn't correct
60 Incorrect 6 ms 13648 KB Output isn't correct
61 Incorrect 6 ms 13648 KB Output isn't correct
62 Incorrect 3 ms 13648 KB Output isn't correct
63 Incorrect 0 ms 13648 KB Output isn't correct
64 Incorrect 6 ms 13648 KB Output isn't correct
65 Incorrect 3 ms 13648 KB Output isn't correct
66 Incorrect 6 ms 13648 KB Output isn't correct
67 Incorrect 3 ms 13648 KB Output isn't correct
68 Incorrect 0 ms 13648 KB Output isn't correct
69 Incorrect 3 ms 13648 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 13648 KB Output isn't correct
2 Incorrect 0 ms 13648 KB Output isn't correct
3 Incorrect 0 ms 13648 KB Output isn't correct
4 Incorrect 0 ms 13648 KB Output isn't correct
5 Incorrect 0 ms 13648 KB Output isn't correct
6 Incorrect 0 ms 13648 KB Output isn't correct
7 Incorrect 0 ms 13648 KB Output isn't correct
8 Incorrect 0 ms 13648 KB Output isn't correct
9 Incorrect 0 ms 13648 KB Output isn't correct
10 Incorrect 0 ms 13648 KB Output isn't correct
11 Incorrect 0 ms 13648 KB Output isn't correct
12 Incorrect 0 ms 13648 KB Output isn't correct
13 Incorrect 0 ms 13648 KB Output isn't correct
14 Incorrect 0 ms 13648 KB Output isn't correct
15 Incorrect 0 ms 13648 KB Output isn't correct
16 Incorrect 0 ms 13648 KB Output isn't correct
17 Incorrect 0 ms 13648 KB Output isn't correct
18 Incorrect 0 ms 13648 KB Output isn't correct
19 Incorrect 0 ms 13648 KB Output isn't correct
20 Incorrect 0 ms 13648 KB Output isn't correct
21 Incorrect 0 ms 13648 KB Output isn't correct
22 Incorrect 0 ms 13648 KB Output isn't correct
23 Incorrect 0 ms 13648 KB Output isn't correct
24 Incorrect 0 ms 13648 KB Output isn't correct
25 Incorrect 0 ms 13648 KB Output isn't correct
26 Incorrect 0 ms 13648 KB Output isn't correct
27 Incorrect 0 ms 13648 KB Output isn't correct
28 Incorrect 0 ms 13648 KB Output isn't correct
29 Incorrect 0 ms 13648 KB Output isn't correct
30 Incorrect 0 ms 13648 KB Output isn't correct
31 Incorrect 0 ms 13648 KB Output isn't correct
32 Incorrect 0 ms 13648 KB Output isn't correct
33 Incorrect 0 ms 13648 KB Output isn't correct
34 Incorrect 0 ms 13648 KB Output isn't correct
35 Incorrect 0 ms 13648 KB Output isn't correct
36 Incorrect 0 ms 13648 KB Output isn't correct
37 Incorrect 0 ms 13648 KB Output isn't correct
38 Incorrect 0 ms 13648 KB Output isn't correct
39 Incorrect 0 ms 13648 KB Output isn't correct
40 Incorrect 0 ms 13648 KB Output isn't correct
41 Incorrect 0 ms 13648 KB Output isn't correct
42 Incorrect 0 ms 13648 KB Output isn't correct
43 Incorrect 0 ms 13648 KB Output isn't correct
44 Incorrect 0 ms 13648 KB Output isn't correct
45 Incorrect 0 ms 13648 KB Output isn't correct
46 Incorrect 0 ms 13648 KB Output isn't correct
47 Incorrect 0 ms 13648 KB Output isn't correct
48 Incorrect 0 ms 13648 KB Output isn't correct
49 Incorrect 0 ms 13648 KB Output isn't correct
50 Incorrect 0 ms 13648 KB Output isn't correct
51 Incorrect 0 ms 13648 KB Output isn't correct
52 Incorrect 0 ms 13648 KB Output isn't correct
53 Incorrect 0 ms 13648 KB Output isn't correct
54 Incorrect 0 ms 13648 KB Output isn't correct
55 Incorrect 6 ms 13648 KB Output isn't correct
56 Incorrect 6 ms 13648 KB Output isn't correct
57 Incorrect 6 ms 13648 KB Output isn't correct
58 Incorrect 6 ms 13648 KB Output isn't correct
59 Incorrect 6 ms 13648 KB Output isn't correct
60 Incorrect 6 ms 13648 KB Output isn't correct
61 Incorrect 6 ms 13648 KB Output isn't correct
62 Incorrect 3 ms 13648 KB Output isn't correct
63 Incorrect 0 ms 13648 KB Output isn't correct
64 Incorrect 6 ms 13648 KB Output isn't correct
65 Incorrect 3 ms 13648 KB Output isn't correct
66 Incorrect 6 ms 13648 KB Output isn't correct
67 Incorrect 3 ms 13648 KB Output isn't correct
68 Incorrect 0 ms 13648 KB Output isn't correct
69 Incorrect 3 ms 13648 KB Output isn't correct
70 Incorrect 6 ms 13648 KB Output isn't correct
71 Incorrect 133 ms 13648 KB Output isn't correct
72 Incorrect 93 ms 13648 KB Output isn't correct
73 Incorrect 123 ms 13648 KB Output isn't correct
74 Incorrect 89 ms 13648 KB Output isn't correct
75 Incorrect 139 ms 13648 KB Output isn't correct
76 Incorrect 136 ms 13648 KB Output isn't correct
77 Incorrect 46 ms 13648 KB Output isn't correct
78 Incorrect 126 ms 13648 KB Output isn't correct
79 Incorrect 133 ms 13648 KB Output isn't correct
80 Incorrect 129 ms 13648 KB Output isn't correct
81 Incorrect 23 ms 13648 KB Output isn't correct
82 Incorrect 86 ms 13648 KB Output isn't correct
83 Incorrect 143 ms 13648 KB Output isn't correct
84 Incorrect 133 ms 13648 KB Output isn't correct
85 Incorrect 123 ms 13648 KB Output isn't correct
86 Incorrect 133 ms 13648 KB Output isn't correct
87 Incorrect 133 ms 13648 KB Output isn't correct
88 Incorrect 23 ms 13648 KB Output isn't correct
89 Incorrect 93 ms 13648 KB Output isn't correct
90 Incorrect 49 ms 13648 KB Output isn't correct
91 Incorrect 3 ms 13648 KB Output isn't correct
92 Incorrect 56 ms 13648 KB Output isn't correct