QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#250382 | #7771. 不是这一道据数构结题 | hos_lyric# | Compile Error | / | / | C++14 | 2.1kb | 2023-11-13 08:12:05 | 2024-07-04 02:24:51 |
Judging History
你现在查看的是最新测评结果
- [2024-07-04 02:24:51]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-11-13 08:12:05]
- 提交
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
int N, Q;
vector<int> A;
vector<int> L, R;
namespace brute {
vector<int> run() {
cerr<<"[brute::run]"<<endl;
vector<int> ans(Q, 0);
for (int q = 0; q < Q; ++q) {
vector<int> bs(A.begin() + L[q], A.begin() + R[q]);
sort(bs.begin(), bs.end(), greater<int>{});
int mn = N;
for (int i = 0; i < R[q] - L[q]; ++i) {
chmin(mn, A[L[q] + i]);
if (mn < bs[i]) {
++ans[q];
}
}
}
return ans;
}
} // brute
int main() {
for (; ~scanf("%d%d", &N, &Q); ) {
A.resize(N);
for (int i = 0; i < N; ++i) {
scanf("%d", &A[i]);
--A[i];
}
L.resize(Q);
R.resize(Q);
for (int q = 0; q < Q; ++q) {
scanf("%d%d", &L[q], &R[q]);
--L[q];
}
const auto ans = brute::run();
for (int q = 0; q < Q; ++q) {
printf("%d\n", ans[q]);
}
}
return 0;
}
Details
cc1plus: fatal error: answer.code: No such file or directory compilation terminated.