Submission #31054

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
310542017-08-06 05:39:17zscoderPort Facility (JOI17_port_facility)C++14
100 / 100
4316 ms611436 KiB
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
using namespace std;
#define SIZE (1<<21)
int toz[SIZE];
class segtree
{
public:
int seg1[22][SIZE];
int seg2[22][SIZE];
int low[SIZE*2],u1[SIZE*2],u2[SIZE*2];
int x[SIZE * 2];
int pt;
void init()
{
for(int i=0;i<SIZE;i++)low[i+SIZE]=u1[i+SIZE]=u2[i+SIZE]=i;
for(int i=SIZE-1;i>=1;i--)low[i]=low[i*2],u1[i]=u1[i*2],u2[i]=u2[i*2];
}
void add1(int beg, int end)
{
int node = 1;
int lb = 0, ub = SIZE - 1;
int dep=0;
for (;;)
{
seg1[dep][u1[node]++]=end;
if (lb == ub)break;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

port_facility.cpp: In function 'int main()':
port_facility.cpp:86:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &num);
                   ^
port_facility.cpp:87:101: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 0; i < num; i++)scanf("%d%d", &a[i], &b[i]), a[i]--, b[i]--, toz[a[i]] = toz[b[i]] = i;
                                                                                                     ^
port_facility.cpp:62:20: warning: array subscript is above array bounds [-Warray-bounds]
     x[pt++] = toz[z];
                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...