Submission #669867

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6698672022-12-07 14:30:16victor_gaoTeams (IOI15_teams)C++17
100 / 100
2221 ms174096 KiB
#include <bits/stdc++.h>
#define pii pair<int,int>
#define x first
#define y second
#define MAXN 500005
using namespace std;
pii stud[MAXN];
int n;
struct segtree{
vector<pii>seg[4*MAXN];
int out[4*MAXN];
bool era[4*MAXN];
int count(int i,int can){
int p=(upper_bound(seg[i].begin(),seg[i].end(),make_pair(can,2))-seg[i].begin())-out[i];
return max(p,0);
}
void build(int l,int r,int i){
era[i]=0; out[i]=0;
sort(seg[i].begin(),seg[i].end());
if (l==r)
return;
int mid=(l+r)>>1;
build(l,mid,2*i);
build(mid+1,r,2*i+1);
}
void add(int l,int r,int i,int p,int c){
if (l==r){
seg[i].push_back({c,0});
return;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

teams.cpp: In member function 'int segtree::count(int, int)':
teams.cpp:14:89: warning: conversion from '__gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >::difference_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   14 |         int p=(upper_bound(seg[i].begin(),seg[i].end(),make_pair(can,2))-seg[i].begin())-out[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...