結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー tassei903tassei903
提出日時 2021-10-29 21:54:53
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 1,636 bytes
コンパイル時間 1,048 ms
コンパイル使用メモリ 88,752 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 14:44:24
合計ジャッジ時間 2,167 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 4 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 5 ms
5,376 KB
testcase_12 AC 5 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 4 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 4 ms
5,376 KB
testcase_20 AC 5 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <set>
#include <queue>
#include <tuple>
#include <string>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define rep(i,n) for(long long i = 0; i < (int)n; i++)

#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;


void print(V<ll> ar) {
    for(auto x: ar)cout << x << " " ;
    cout << endl;
}

ll gcd(ll a, ll b) {
    if (a<b)return gcd(b,a);
    if (b==0)return a;
    return gcd(b, a%b);
}

ll mpow(ll x, ll n, ll p) {
    ll r = 1;
    while (n>0) {
        if (n%2) {
            r*=x;
            r%=p;
        }
        x *= x;
        x %= p;
        n/=2;
    }
    return r;
}
const ll mod = 998244353;

ll f(ll rest, ll a) {
    ll r = 0;
    rep(i, a) {
        //cout << rest+i+1 << " " << mpow((rest+i+1)%mod, mod-2, mod) << endl;
        r += mpow((rest+i+1)%mod, mod-2, mod);
    }
    return r;
}


int main()
{
    int n, m;
    cin >> n >> m;
    V<int> x(n),y(m);
    rep(i, n)cin >> x[i];
    rep(i, m)cin >> y[i];
    sort(y.begin(), y.end());
    rep(i, n) {
        int z = m;
        rep(j, m) {
            if (x[i]<y[j]) {
                z = j;
                break;
            }
        }
        if (z==m)cout << "Infinity" << endl;
        else cout << y[z]-x[i] << endl;
    }
}
0