| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363573 | FZ_Laabidi | PPP (EGOI23_ppp) | C++20 | 64 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;// index where yi ost, aka i
}
whohowmuch[m-1]= make_pair(x[m-1].F, 1);
for(int i = m-2; i>-1; i--){
int wi = x[i].F;
if(lost[wi] == m)
whohowmuch[i]= make_pair(wi, m-i);
else {
pair<int, int> contender = whohowmuch[lost[wi]];
int curdur = lost[wi]-i;
if(contender.S> curdur )whohowmuch[i]= contender;
else whohowmuch[i]= make_pair(wi, 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... | ||||
