QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#777202 | #9788. Shreckless | ucup-team008# | RE | 1ms | 3832kb | C++17 | 3.7kb | 2024-11-23 23:39:41 | 2024-11-23 23:39:42 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>
#include <omp.h>
using namespace std;
// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
typedef vector<int> vi;
#define f first
#define s second
#define derr if(1) cerr
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << flush;
// END NO SAD
template<class Fun>
class y_combinator_result {
Fun fun_;
public:
template<class T>
explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}
template<class ...Args>
decltype(auto) operator()(Args &&...args) {
return fun_(std::ref(*this), std::forward<Args>(args)...);
}
};
template<class Fun>
decltype(auto) y_combinator(Fun &&fun) {
return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
}
template<class T>
bool updmin(T& a, T b) {
if(b < a) {
a = b;
return true;
}
return false;
}
template<class T>
bool updmax(T& a, T b) {
if(b > a) {
a = b;
return true;
}
return false;
}
typedef int64_t ll;
int best(const vector<int>& a, const vector<int>& b) {
int lhs = 0;
int rhs = sz(a);
while(lhs < rhs) {
int mid = (lhs+rhs+1)/2;
bool valid = true;
for(int i = 0; valid && i < mid; i++) {
valid = a[sz(a)-mid+i] > b[i];
}
if(valid) lhs = mid;
else rhs = mid-1;
}
return lhs;
}
void rsolve() {
int r, c;
cin >> r >> c;
vector<vector<int>> g(c);
for(auto& x: g) x.resize(r);
for(int i = 0; i < r; i++) {
g[i].resize(c);
for(int j = 0; j < c; j++) cin >> g[j][i];
}
for(int i = 0; i < c; i++) sort(all(g[i]));
ll ret = 0;
for(int i = 0; i + 1 < c; i++) {
ret += best(g[i], g[i+1]);
}
if(ret >= r) cout << "YES\n";
else cout << "NO\n";
}
void solve() {
int t;
cin >> t;
while(t--) rsolve();
}
// what would chika do
// are there edge cases (N=1?)
// are array sizes proper (scaled by proper constant, for example 2* for koosaga tree)
// integer overflow?
// DS reset properly between test cases
// are you doing geometry in floating points
// are you not using modint when you should
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3832kb
input:
3 2 2 69 69 2024 42 3 3 1 1 1 1 1 1 2 2 2 3 4 1 1 1 1 1 1 1 1 2 2 2 2
output:
YES NO YES
result:
ok 3 token(s): yes count is 2, no count is 1
Test #2:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
3 2 2 69 69 2024 42 3 3 1 1 1 1 1 1 2 2 2 3 4 1 1 1 1 1 1 1 1 2 2 2 2
output:
YES NO YES
result:
ok 3 token(s): yes count is 2, no count is 1
Test #3:
score: -100
Runtime Error
input:
20000 6 2 12 4 8 24 2 10 1 22 3 15 18 20 3 3 3 8 18 2 17 15 13 4 6 3 3 7 17 15 8 6 3 18 13 9 3 3 2 3 14 1 7 17 4 6 13 3 3 6 10 14 3 9 13 1 7 15 2 4 1 3 16 14 6 10 4 2 3 3 3 2 17 7 11 13 16 5 18 2 3 2 3 6 4 1 5 2 4 4 6 13 14 2 11 12 16 3 3 2 8 12 4 9 17 5 7 18 3 2 5 10 8 9 1 6 2 2 2 4 1 3 2 3 12 6 1 ...