結果
問題 |
No.8042 本棚
|
ユーザー |
👑 |
提出日時 | 2021-11-02 14:52:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 238 bytes |
コンパイル時間 | 2,047 ms |
コンパイル使用メモリ | 179,976 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 18:49:25 |
合計ジャッジ時間 | 2,990 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
main.cpp:2:51: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | using namespace std;struct x{string f,s;};int n,i;main(){cin>>n;x A[n];for(i=0;n>i;)cin>>A[i].f>>A[i++].s;sort(A,A+n,[&](x a,x b){return(a.f==b.f?a.s<b.s:a.f<b.f);});for(i=0;n>i;)cout<<A[i].f<<" "<<A[i++].s<<"\n";} | ^~~~
ソースコード
#include"bits/stdc++.h" using namespace std;struct x{string f,s;};int n,i;main(){cin>>n;x A[n];for(i=0;n>i;)cin>>A[i].f>>A[i++].s;sort(A,A+n,[&](x a,x b){return(a.f==b.f?a.s<b.s:a.f<b.f);});for(i=0;n>i;)cout<<A[i].f<<" "<<A[i++].s<<"\n";}