---
# System prepended metadata

title: 2024下學期 期末好玩的遊戲
tags: [WIC簡報]

---

# 2024下學期 期末好玩的遊戲

link: https://wego2024.contest.codeforces.com/group/nPd9IxKliH/contest/614750

### Problem A
```c++=
#include<bits/stdc++.h>
using namespace std;

int main(){
    string x;
    cin>>x;
    cout<<x;
}
```

### Problem B
```c++=
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n, m, k , x, y;
    cin>>n>>m>>k>>x>>y;
    if(x>=n||y>=m) cout<<y-k;
    else cout<<y;
}
```

### Problem C
```c++=
#include<bits/stdc++.h>
using namespace std;

int main(){
    int t0, t1, t2, t3;
    cin>>t0>>t1>>t2>>t3;
    cout<<((t1-t0)+(t2-t3))/2<<" "<<(t3-t0)-(t2-t1);
}
```

### Problem D
```c++=
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin>>n; 
    vector<int> counter(2101,0);
    for(int i=0; i<n; i++){
        int a, b, c;
        cin>>a>>b>>c;
        counter[4*a+8*b+9*c]++;
    }
    for(int i=0; i<2101; i++){
        if(counter[i]>0) cout<<i<<" "<<counter[i]<<"\n";
    }
}
```

### Problem E
```c++=
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n, m;
    cin>>n>>m;
    cout<<m+1-n;
}
```

### Problem F
```c++=
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> box(n);
    for(int i = 0; i < n; i++){
        cin>>box[i].first>>box[i].second;
    }
    sort(box.begin(), box.end());
    vector<pair<int, int>> piles;
    for(auto[l, w] : box){
        bool placed=false;
        for(auto &top : piles){
            if(top.first<l&&top.second<w){
                top={l, w};
                placed = true;
                break;
            }
        }
        if(!placed) piles.push_back({l, w});
    }
    cout<<piles.size()<<endl;
}
```