| 比赛 |
进阶指南第0章测试 |
评测结果 |
RRRRRRRRRRRRRRRRRRRR |
| 题目名称 |
借教室 |
最终得分 |
0 |
| 用户昵称 |
王潇翊 |
运行时间 |
0.060 s |
| 代码语言 |
C++ |
内存使用 |
3.69 MiB |
| 提交时间 |
2026-03-14 10:12:33 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N = 1007;
int n,m;
long long a[N];
int main()
{
freopen("classrooms.in","r",stdin);
freopen("classrooms.in","w",stdout);
cin >> n >> m;
if (n > 1000)
{
cout << 0;
return 0;
}
for (int i = 1;i <= n;i++)
{
cin >> a[i];
}
for (int i = 1,x,y,z;i <= m;i++)
{
bool f = 0;
cin >> x >> y >> z;
for (int j = y;j <= z;j++)
{
a[j] -= x;
if (a[j] < 0)
{
cout << -1 << endl << i;
return 0;
}
}
}
cout << 0;
return 0;
}