제출 #1032875

#제출 시각아이디문제언어결과실행 시간메모리
1032875socpite팀들 (IOI15_teams)C++17
0 / 100
1035 ms203560 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; const int maxn = 5e5+5; const long long INF = 1e18; vector<int> FW[maxn]; vector<int> d[maxn]; int pfx_all[maxn], sfx_all[maxn]; int L[maxn], R[maxn]; int n; void add(int x, int y){ for(x; x <= n; x += x&(-x)){ for(int idx = lower_bound(d[x].begin(), d[x].end(), y) - d[x].begin(); idx < d[x].size(); idx += idx&(-idx))FW[x][idx]++; } } int gt(int x, int y){ int re = 0; for(x; x > 0; x -= x&(-x)){ for(int idx = upper_bound(d[x].begin(), d[x].end(), y) - d[x].begin() - 1; idx > 0; idx -= idx&(-idx))re += FW[x][idx]; } return re; } void init(int N, int A[], int B[]) { n = N; for(int i = 0; i < n; i++){ L[i] = A[i]; R[i] = B[i]; for(int x = B[i]; x <= n; x += x&(-x))d[x].push_back(A[i]); pfx_all[B[i]]++; sfx_all[A[i]]++; } for(int i = 1; i <= n; i++){ pfx_all[i] += pfx_all[i-1]; d[i].push_back(-1); sort(d[i].begin(), d[i].end()); d[i].erase(unique(d[i].begin(), d[i].end()), d[i].end()); FW[i].assign(d[i].size(), 0); } for(int i = n; i >= 1; i--)sfx_all[i] += sfx_all[i+1]; for(int i = 0; i < n; i++)add(B[i], A[i]); } int can(int M, int K[]) { long long pfx_M = 0, pfx_gap = 0, mn = INF; sort(K, K+M); // sum_segment - sum_M < 0 => bad // sum_segment = pfx_all - sumgap bitset<105> bs[M]; for(int i = 0; i < M; i++){ for(int j = 0; j < n; j++)bs[i].set(j, L[j] <= K[i] && K[i] <= R[j]); bitset<105> tmp; long long sum = 0; for(int j = i; j >= 0; j--){ tmp|=bs[j]; sum += K[j]; if(tmp.count() < sum)return 0; } } return 1; }

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In function 'void add(int, int)':
teams.cpp:17:6: warning: statement has no effect [-Wunused-value]
   17 |  for(x; x <= n; x += x&(-x)){
      |      ^
teams.cpp:18:58: warning: conversion from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   18 |   for(int idx = lower_bound(d[x].begin(), d[x].end(), y) - d[x].begin(); idx < d[x].size(); idx += idx&(-idx))FW[x][idx]++;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
teams.cpp:18:78: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int idx = lower_bound(d[x].begin(), d[x].end(), y) - d[x].begin(); idx < d[x].size(); idx += idx&(-idx))FW[x][idx]++;
      |                                                                          ~~~~^~~~~~~~~~~~~
teams.cpp: In function 'int gt(int, int)':
teams.cpp:24:6: warning: statement has no effect [-Wunused-value]
   24 |  for(x; x > 0; x -= x&(-x)){
      |      ^
teams.cpp:25:73: warning: conversion from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   25 |   for(int idx = upper_bound(d[x].begin(), d[x].end(), y) - d[x].begin() - 1; idx > 0; idx -= idx&(-idx))re += FW[x][idx];
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
teams.cpp: In function 'int can(int, int*)':
teams.cpp:64:19: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   64 |    if(tmp.count() < sum)return 0;
      |       ~~~~~~~~~~~~^~~~~
teams.cpp:52:12: warning: unused variable 'pfx_M' [-Wunused-variable]
   52 |  long long pfx_M = 0, pfx_gap = 0, mn = INF;
      |            ^~~~~
teams.cpp:52:23: warning: unused variable 'pfx_gap' [-Wunused-variable]
   52 |  long long pfx_M = 0, pfx_gap = 0, mn = INF;
      |                       ^~~~~~~
teams.cpp:52:36: warning: unused variable 'mn' [-Wunused-variable]
   52 |  long long pfx_M = 0, pfx_gap = 0, mn = INF;
      |                                    ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...