您的答案為: Number: 12 6 13 7 14 0 正確答案為: Number: 12 6 13 7 0 14
您的答案為: Number: 8989 127 7878 129 140 0 86 117 77777 118 123114 120 99995999 122 456444 123 979 124 1 125 正確答案為: Number: 8989 127 7878 129 140 1 86 117 77777 118 123114 120 99995999 122 456444 123 979 124 0 125
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<pair<int, int>> z(n);
int boy, time;
while (cin >> boy >> time) {
for (int i = 0; i < n; i++) {
if (z[i].second != 0) {
z[i].second--;
}
if(z[i].second==0){
z[i].first=0;
}
}
bool v = false;
for (int i = 0; i < n; i += 2) {
if (z[i].second == 0) {
z[i] = make_pair(boy, time);
cout << "Number:";
for (pair<int, int> q : z) {
cout << ' ' << q.first;
}
cout << "\n Time:";
for (pair<int, int> q : z) {
cout << ' ' << q.second;
}
cout << "\n";
v = true;
break;
}
}
if (v) {
continue;
}
for (int i = 1; i < n; i += 2) {
if (z[i].second == 0) {
z[i] = make_pair(boy, time);
cout << "Number:";
for (pair<int, int> q : z) {
cout << ' ' << q.first;
}
cout << "\n Time:";
for (pair<int, int> q : z) {
cout << ' ' << q.second;
}
cout << "\n";
v = true;
break;
}
}
if (v) {
continue;
}
cout << " Not enough\nNumber:";
for (pair<int, int> q : z) {
cout << ' ' << q.first;
}
cout << "\n Time:";
for (pair<int, int> q : z) {
cout << ' ' << q.second;
}
cout << "\n";
}
}