1 条题解
-
0
C++ :
#include <bits/stdc++.h> #include <map> using namespace std; int n, p, h, m; int a[10005]; map<int, int> ma; int main() { cin >> n >> p >> h >> m; for (int i = 0, x, y; i < m; i++) { cin >> x >> y; if (x > y) swap(x, y); if (ma[x] != y) { a[x + 1] -= 1; a[y] += 1; ma[x] = y; } } for (int i = 1; i <= n; i++) { a[i] = a[i - 1] + a[i]; } for (int i = 1; i <= n; i++) { cout << a[i] + h << endl; } }
信息
- ID
- 1277
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- (无)
- 递交数
- 0
- 已通过
- 0
- 上传者