Submission #125487

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1254872019-07-05 13:17:01imyujinLong Mansion (JOI17_long_mansion)C++14
100 / 100
1177 ms145976 KiB
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
#define MAXN 500005
int N;
vector<int> A[MAXN];
int B[MAXN], C[MAXN], X[MAXN], Y[MAXN];
int left[MAXN], rig[MAXN], lefinv[MAXN], riginv[MAXN];
int L[MAXN], R[MAXN], Rinv[MAXN];
int lastkey[MAXN], sparse[20][MAXN];
vector<int> mn[MAXN], mnt[MAXN];
void findleft(vector<int> A[], int C[], int left[]) {
for(int i = 1; i <= N; i++) lastkey[i] = 0;
for(int i = 1; i < N; i++) {
for(auto a : A[i]) lastkey[a] = i;
left[i] = lastkey[C[i]];
}
left[0] = left[N] = 0;
}
void setL(int left[], int rig[], int L[]) {
priority_queue<int> pq, pqt;
//printf("*\n");
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

long_mansion.cpp: In function 'void setL(int*, int*, int*)':
long_mansion.cpp:34:66: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   sparse[i][j] = min(sparse[i - 1][j], sparse[i - 1][j - (1 << i - 1)]);
                                                                ~~^~~
long_mansion.cpp: In function 'int main()':
long_mansion.cpp:67:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
long_mansion.cpp:68:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1; i < N; i++) scanf("%d", C + i);
                             ~~~~~^~~~~~~~~~~~~
long_mansion.cpp:70:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", B + i);
   ~~~~~^~~~~~~~~~~~~
long_mansion.cpp:73:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &t);
    ~~~~~^~~~~~~~~~
long_mansion.cpp:77:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &Q);
  ~~~~~^~~~~~~~~~
long_mansion.cpp:78:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 0; i < Q; i++) scanf("%d%d", X + i, Y + i);
                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...