Submission #1272445

#TimeUsernameProblemLanguageResultExecution timeMemory
1272445doqExamination (JOI19_examination)C++20
0 / 100
3 ms4408 KiB
#include<bits/stdc++.h> using namespace std; #define sz(x) (int) (x).size() #define ALL(x) (x).begin(),(x).end() #define pb push_back const int N = 2e5 + 5; struct pp{ int fi, se, th, o, id = 0; } a[N]; struct po { int fi, se, id; }; bool c1 (po a, po b){ if(a.fi != b.fi) return a.fi > b.fi; return a.se > b.se; } int ans[N], q, n; bool cmp(pp a, pp b) { if(a.fi != b.fi) return a.fi > b.fi; if(a.o != b.o) return a.o < b.o; if(a.se != b.se) return a.se > b.se; } struct BIT { int f[N * 3]; void update(int id, int val) { for(; id > 0; id -= id & (-id)) f[id] += val; } int get(int id) { int res = 0; for(; id < N * 3; id += id & (-id)) res += f[id]; return res; } void mem() { memset(f, 0, sizeof(f)); } }bit; void dnc(int l, int r) { if(l == r) return; int m = (l + r) >> 1; dnc(l, m); dnc(m + 1, r); } vector<int> k, vx; int id(int n) { return lower_bound(ALL(vx), n) - vx.begin() + 1; } void nen() { for(int i = 1; i <= n + q; i++) { k.pb(a[i].fi); k.pb(a[i].se); k.pb(a[i].th); } sort(ALL(k)); k.erase(unique(ALL(k)), k.end()); vx = k; for(int i = 1; i <= n + q; i++) { a[i].fi = id(a[i].fi); a[i].se = id(a[i].se); a[i].th = id(a[i].th); } } main() { ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0); #define task "ANHDEP" freopen(task ".inp", "r", stdin); freopen(task ".out", "w", stdout); cin >> n >> q; for(int i = 1; i <= n; i++) { cin >> a[i].fi >> a[i].se; a[i].th = a[i].fi + a[i].se; a[i].o = 0; } for(int i = 1; i <= q; i++) { cin >> a[i + n].fi >> a[i + n].se >> a[i + n].th; a[i + n].id = i; a[i + n].o = 1; } nen(); sort(a + 1, a + n + q + 1, cmp); // for(int i = 1; i <= n + q; i++) // cout << a[i].fi << ' ' << a[i].se << ' ' << a[i].th << ' ' << a[i].id << '\n'; // dnc(1, n + q); for(int i = 1; i <= q; i++) cout << ans[i] << '\n'; }

Compilation message (stderr)

examination.cpp:71:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   71 | main() {
      | ^~~~
examination.cpp: In function 'bool cmp(pp, pp)':
examination.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
   25 | }
      | ^
examination.cpp: In function 'int main()':
examination.cpp:74:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |     freopen(task ".inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
examination.cpp:75:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |     freopen(task ".out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...