This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma optimize("Bismillahirrahmanirrahim");
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename T> istream& operator>>(istream& is, vector<T> &v){for (auto &it : v) is>>it;return is;}
template<typename T, size_t Y> istream& operator>>(istream& is, array<T,Y> &v){for (auto &it : v) is>>it;return is;}
template<typename T> ostream& operator<<(ostream& os, vector<T> &v){for (auto &it : v) os<<it<<" ";return os;}
template<typename T, size_t Y> ostream& operator<<(ostream& os, array<T,Y> &v){for (auto &it : v) os<<it<<" ";return os;}
template<typename X, typename Y> istream& operator>>(istream& is, pair<X,Y> &pr){return is<<pr.first<<" "<<pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> &pr){return os>>pr.first>>pr.second;}
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define vint(x) vector<int> x
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define rev(x) reverse(x.begin(), x.end())
#define endl '\n'
#define tol(bi) (1LL<<((int)(bi)))
typedef long long ll;
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "teams.h"
struct SegTree{
vector<pair<int,int>> segtree;
void init(int n){
/*ahmet23 orz*/
}
void update(int l, int r){
segtree.push_back({l,r});
}
int query(int x){
int tot = 0;
for (int i = 0; i < segtree.size(); i++){
if (segtree[i].first<=x && segtree[i].second>=x) tot++;
}
return tot;
}
int query2(int l, int r){
int tot = 0;
for (int i = 0; i < segtree.size(); i++){
if (segtree[i].first<=l && segtree[i].second>=r) tot++;
}
return tot;
}
};
SegTree segtree;
void init(int N, int A[], int B[]) {
segtree.init(N);
for (int i = 0; i < N; i++){
segtree.update(A[i],B[i]);
}
}
int can(int m, int k[]) {
sort(k, k+m);
int lel = 0;
for (int i = 0; i < m; i++){
int pos = k[i];
int kapsa = segtree.query(pos);
int hh = 0;
if (i<m-1) hh=segtree.query2(pos,k[i+1]);
int hueh = lel+pos;
lel=0;
if (kapsa<hueh) return 0;
kapsa-=hueh;
if (kapsa>hh) continue;
else {
lel=hh-kapsa;
}
}
return 1;
}
Compilation message (stderr)
teams.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim");
|
teams.cpp: In member function 'void SegTree::init(int)':
teams.cpp:36:16: warning: unused parameter 'n' [-Wunused-parameter]
36 | void init(int n){
| ~~~~^
teams.cpp: In member function 'int SegTree::query(int)':
teams.cpp:44:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for (int i = 0; i < segtree.size(); i++){
| ~~^~~~~~~~~~~~~~~~
teams.cpp: In member function 'int SegTree::query2(int, int)':
teams.cpp:51:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
51 | for (int i = 0; i < segtree.size(); i++){
| ~~^~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |