acwing刷题
目录
6122. 农夫约翰的奶酪块
6123. 哞叫时间
6122. 农夫约翰的奶酪块
#include <iostream>
using namespace std;
int res;
int n, q;
int X[1010][1010];
int Y[1010][1010];
int Z[1010][1010];
void solve()
{int x, y, z;cin >> x >> y >> z;X[x][y]++;Y[y][z]++;Z[x][z]++;if (X[x][y] == n){res++;}if (Y[y][z] == n){res++;}if (Z[x][z] == n){res++;}cout << res << endl;
}
int main()
{cin >> n >> q;while (q--){solve();}return 0;
}
6123. 哞叫时间
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long
void solve()
{int n;cin >> n;int s[500010] = {0};int left = n / 2 + 1;int x = 1e15;for (int i = 1; i <= n; i++){int t;cin >> t;s[i] = s[i - 1] + t;if (i >= left){x = min(x, s[i] - s[i - left]);}}int y = s[n] - x;cout << x << " " << y << endl;
}
signed main()
{int t;cin >> t;while (t--){solve();}return 0;
}