結果
| 問題 |
No.938 賢人を探せ
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-06 17:13:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 715 bytes |
| コンパイル時間 | 2,802 ms |
| コンパイル使用メモリ | 194,488 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-14 11:58:22 |
| 合計ジャッジ時間 | 4,047 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
#include<bits/stdc++.h>
int main(){
int n;std::cin>>n;
std::vector<std::string>a(n);
std::vector<std::pair<std::string,int>>b(n);
for(int i=0;i<n;i++){
std::cin>>a.at(i)>>b.at(i).first;
b.at(i).second=i;
}
std::sort(a.begin(),a.end());
std::sort(b.begin(),b.end());
std::vector<std::pair<int,std::string>>ans;
for(int i=0,j=0;j<n;j++){
if(j&&b.at(j-1).first==b.at(j).first)continue;
for(;i<n&&a.at(i)<b.at(j).first;i++);
if(i==n||b.at(j).first<a.at(i)){
ans.emplace_back(b.at(j).second,b.at(j).first);
}
}
std::sort(ans.begin(),ans.end());
for(auto&&p:ans){
std::cout<<p.second<<std::endl;
}
}
ngtkana