| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1370210 | Andrey | Restaurant Recommendation Rescue (CCO25_day2problem1) | C++17 | 19 ms | 4188 KiB |
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,a;
cin >> n;
vector<int> haha(n+1);
for(int i = 1; i <= n; i++) {
cin >> a;
a--;
haha[i] = haha[i-1]+a;
}
vector<int> pr(n+1);
for(int i = 1; i <= n; i++) {
pr[i] = min(pr[i-1],haha[i]);
}
long long br = 0,sb = 0,sm = INT_MAX;
for(int i = n; i >= 1; i--) {
sm = min(haha[i],(int)sm);
if(haha[i] == sm) {
if(pr[i-1] >= sm+1) {
br++;
sb+=i-1;
}
}
}
cout << br << " " << sb;
return 0;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
