QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#446927 | #6389. Topical | nikaa123 | 12 | 144ms | 167456kb | C++23 | 2.5kb | 2024-06-17 18:19:03 | 2024-06-17 18:19:05 |
Judging History
answer
// #pragma GCC diagnostic warning "-std=c++11"
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pp pop_back
#define endl '\n'
#define ff first
#define ss second
#define stop exit(0)
#define sz(x) (int)x.size()
#define pause system("pause")
#define all(x) (x).begin(),(x).end()
#define deb(x) cout << #x << "-" << x << endl
typedef char chr;
typedef string str;
typedef long long ll;
typedef vector <int> vii;
typedef pair <int,int> pii;
const long long INF = LLONG_MAX;
const int inf = INT_MAX;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const int dx[] = {0,0,-1,1};
const int dy[] = {-1,1,0,0};
const double PI = 2 * acos(0.0);
const int N = 1e6 + 5;
int n,k,a;
vector <vector<pii>> v(N);
int pref[N],cnt[N];
vii vr;
int p[N];
inline void test_case () {
cin >> n >> k;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= k; j++) {
cin >> a;
v[j].pb(make_pair(a,i));
if (a == 0) {
cnt[i]++;
if (cnt[i] == k) {
vr.pb(i);
}
}
}
}
int c[n+10][k+10];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= k; j++) {
cin >> c[i][j];
}
}
for (int i = 1; i <= max(n,k); i++) {
pref[i] = -1;
cnt[i] = 0;
}
for (int i = 0; i < sz(vr); i++) {
cnt[vr[i]] = k;
}
for (int i = 1; i <= k; i++) {
sort(all(v[i]));
}
for (int i = 0; i < sz(vr); i++) {
for (int j = 1; j <= k; j++) {
p[j] += c[vr[i]][j];
while (pref[j]+1<sz(v[j])) {
if (p[j] >= v[j][pref[i]+1].ff) {
pref[j] += 1;
cnt[v[j][pref[j]].ss] += 1;
if (cnt[v[j][pref[j]].ss] == k) {
vr.pb(v[j][pref[j]].ss);
}
} else {
break;
}
}
}
}
cout << sz(vr) << endl;
}
signed main () {
ios_base :: sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int T = 1;
// cin >> T;
while(T--) {
test_case();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 12
Accepted
Test #1:
score: 12
Accepted
time: 0ms
memory: 26456kb
input:
1 1 693647287 340782526
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 12
Accepted
time: 0ms
memory: 26436kb
input:
1 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 279985824 991797187 998715443 98505529 106002744 636773096 815089164 196160830 796988849 87975...
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 12
Accepted
time: 4ms
memory: 27948kb
input:
1 10000 841961872 0 0 0 0 0 0 0 0 0 0 0 0 0 831386430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 205210920 705123207 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 276768098 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 661649446 0 0 0 0 0 0 0 0 0 0 ...
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 12
Accepted
time: 134ms
memory: 167456kb
input:
1 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 12
Accepted
time: 134ms
memory: 167292kb
input:
1 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 12
Accepted
time: 144ms
memory: 167324kb
input:
1 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 12
Accepted
time: 102ms
memory: 159424kb
input:
1 1000000 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 10...
output:
0
result:
ok 1 number(s): "0"
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 4ms
memory: 26404kb
input:
100 1 893339036 896783899 690308537 201770764 262364362 105000893 770698921 744238454 470980016 935046317 642998516 100481910 392307650 116783134 196939768 372329082 346372520 43063564 245523488 389084350 130314590 412588681 987795927 681635353 304582580 472268968 700147283 743357606 792644412 99955...
output:
100
result:
wrong answer 1st numbers differ - expected: '85', found: '100'
Subtask #3:
score: 0
Wrong Answer
Test #15:
score: 21
Accepted
time: 7ms
memory: 28084kb
input:
10000 1 568857328 651788426 751475430 102940442 763289419 468657944 770847628 780257867 16919385 575963868 281824241 291248174 140016533 313529232 302186452 32709864 787073783 1926820 239509174 220454071 34252400 390385721 675239026 245106357 489697460 28435096 825528061 159083009 16370561 223299279...
output:
10000
result:
ok 1 number(s): "10000"
Test #16:
score: 0
Wrong Answer
time: 23ms
memory: 39996kb
input:
100000 1 78763439 671847244 661890823 215179284 804182046 667280820 140277780 822235648 809998506 39559747 459311656 212179350 227573276 606854131 182676019 61302123 281509402 53785090 106827674 911115512 31998233 678388767 75425082 154920343 882021740 976962371 219500493 609794633 780392857 6696241...
output:
100000
result:
wrong answer 1st numbers differ - expected: '68284', found: '100000'
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%