結果
| 問題 | No.1703 Much Matching |
| コンテスト | |
| ユーザー |
houren
|
| 提出日時 | 2021-10-08 23:20:42 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 884 bytes |
| 記録 | |
| コンパイル時間 | 1,740 ms |
| コンパイル使用メモリ | 170,008 KB |
| 実行使用メモリ | 11,108 KB |
| 最終ジャッジ日時 | 2024-07-23 07:16:20 |
| 合計ジャッジ時間 | 5,584 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 WA * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
int main(){
int n,m,q;
cin >> n >> m >> q;
vector<int> cx(q,MOD),cy(q,MOD);
rep(i,q){
int a,b;
cin >> a >> b;
int low = lower_bound(all(cx),a) - cx.begin();
int up = upper_bound(all(cx),a) - cx.begin();
if(low == up){
if(low && cy[low-1] >= b) continue;
cx[low] = a; cy[low] = b;
}else{
int itr = lower_bound(cy.begin()+low, cy.begin()+up, b) - cy.begin();
if(itr && cy[itr-1] >= b) continue;
cx[itr] = a; cy[itr] = b;
}
}
int ans = 0;
rep(i,q){
if(cx[i]==MOD) break;
ans++;
}
cout << ans << endl;
return 0;
}
houren