#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define nn '\n'
const int N = 2e5 + 1;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
int r[n + 1][k + 1], u[n + 1][k + 1];
if (n == 1) {
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= k; j++)
{
cin >> r[i][j];
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= k; j++)
{
cin >> u[i][j];
}
}
int cnt = 0;
int mus = 0;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= k; j++)
{
if(mus >= r[i][j])
{
mus+=u[i][j];
cnt++;
}
}
}
if(cnt == k)
{
cout << 1 << nn ;
}
else
{
cout << 0 << nn ;
}
}
}
| # | 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... |