| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363561 | FZ_Laabidi | PPP (EGOI23_ppp) | C++20 | 65 ms | 5368 KiB |
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
signed main(){
int n; cin >> n;
int m; cin >> m;
vector<pair<int, int>> whohowmuch(m);
vector<int> ans(n, 0), lost(n, m);
vector<pair<int, int>> x(m);
for(int i=0; i<m; i++){
cin >> x[i].F >> x[i].S;
lost[x[i].S]= i;
}
whohowmuch[m-1]= make_pair(x[m-1].F, 1);
for(int i = m-2; i>-1; i--){
int curdur = lost[x[i].F]-i;
if(whohowmuch[lost[x[i].F]].S>curdur)
whohowmuch[i]= make_pair(whohowmuch[lost[x[i].F]].F, whohowmuch[lost[x[i].F]].S);
else
whohowmuch[i]= make_pair(x[i].F, curdur);
}
for(int i=0; i<m; i++)ans[whohowmuch[i].F]++;
for(auto it: ans)cout << it << " ";
}| # | 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... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
