結果
| 問題 |
No.2615 ペアの作り方
|
| コンテスト | |
| ユーザー |
鴨志田卓
|
| 提出日時 | 2024-02-02 00:09:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 813 bytes |
| コンパイル時間 | 2,055 ms |
| コンパイル使用メモリ | 202,056 KB |
| 最終ジャッジ日時 | 2025-02-19 01:03:13 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘void fileIO(std::string)’:
main.cpp:5:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | freopen((s + ".in").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:6:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | freopen((s + ".out").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fileIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
const int N = 2e5 + 10;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n), b(n), c;
for(int i = 0; i < n; i ++)
cin >> a[i];
for(int i = 0; i < n; i ++)
cin >> b[i];
c = a;
c.insert(c.end(), b.begin(), b.end());
sort(c.begin(), c.end());
int ans = 1, cnt = 0;
for(int i = 0; i < n; i ++) {
if(a[i] < c[n]) cnt ++;
}
for(int i = 1; i <= cnt; i ++)
ans = (long long)ans * i % 998244353;
cnt = n - cnt;
for(int i = 1; i <= cnt; i ++)
ans = (long long)ans * i % 998244353;
cout << ans;
return 0;
}
鴨志田卓