| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 985918 | SmuggingSpun | Examination (JOI19_examination) | C++14 | 577 ms | 32160 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
const int lim = 4e5 + 5;
struct FenwickTree{
int bit[lim];
FenwickTree(){
memset(bit, 0, sizeof(bit));
}
void update(int p){
for(; p < lim; p += p & -p){
bit[p]++;
}
}
int get(int p){
int ans = 0;
for(; p > 0; p -= p & -p){
ans += bit[p];
}
return ans;
}
};
vector<tuple<int, int, int, int>>query;
FenwickTree X, Y;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
int n, q;
cin >> n >> q;
map<int, int>index;
for(int _ = 0; _ < n; _++){
int s, t;
cin >> s >> t;
query.emplace_back(s, t, s + t, index[s] = index[t] = 0);
}
for(int i = 1; i <= n; i++){
int x, y, z;
cin >> x >> y >> z;
index[x] = index[y] = 0;
query.emplace_back(x, y, max(x + y, z), i);
}
sort(query.begin(), query.end(), [&] (auto i, auto j) -> bool{
if(get<2>(i) != get<2>(j)){
return get<2>(i) > get<2>(j);
}
return get<3>(i) < get<3>(j);
});
int cnt = 0;
for(auto& [x, y] : index){
y = ++cnt;
}
cnt = 0;
vector<int>ans(q + 1);
for(auto& [x, y, z, i] : query){
if(i == 0){
X.update(index[x]);
Y.update(index[y]);
cnt++;
}
else{
ans[i] = cnt - X.get(index[x] - 1) - Y.get(index[y] - 1);
}
}
for(int i = 1; i <= q; i++){
cout << ans[i] << "\n";
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
