結果
問題 | No.989 N×Mマス計算(K以上) |
ユーザー |
![]() |
提出日時 | 2020-02-14 22:15:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 832 ms / 2,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 1,696 ms |
コンパイル使用メモリ | 169,504 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-06 12:29:08 |
合計ジャッジ時間 | 5,182 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int N,M,K;cin>>N>>M>>K;char op;cin>>op;long long B[M];for (int i=0;i<M;i++){cin>>B[i];}sort(B,B+M);long long A[N];for (int i=0;i<N;i++){cin>>A[i];}sort(A,A+N);long long cnt=0;if (op=='+'){for(int i=0;i<N;i++){for(int j=0;j<M;j++){if(A[i]+B[j]>=K){cnt=cnt+M-j;break;}}}cout<<cnt<<endl;return 0;}for(int i=0;i<N;i++){for(int j=0;j<M;j++){if(A[i]*B[j]>=K){cnt=cnt+M-j;break;}}}cout<<cnt<<endl;;return 0;}