QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#821621#9061. Streets BehindTeapot#WA 0ms3684kbC++141.5kb2024-12-19 16:59:302024-12-19 16:59:30

Judging History

你现在查看的是最新测评结果

  • [2024-12-19 16:59:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-12-19 16:59:30]
  • 提交

answer

/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t;
    cin >> t;
    FOR(_,0,t)
    {
        ll n,k,a,b;
        cin >> k >> n >> a >> b;
        ll res = 0;
        while(n > 0)
        {
            if((k*(b-a))/a == 0)
            {
                res == -1;
                break;
            }
            //cout << k << ' ';
            n -= (k*(b-a))/a;
            k += (k*(b-a))/a;
            res++;
        }
        cout << res << endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

input:

3
9 5 5 6
2 7 1 8
3 4 1 5

output:

3
1
1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3684kb

input:

54
1 1 1 1
1 1 1 2
1 1 1 3
1 1 2 2
1 1 2 3
1 1 3 3
1 2 1 1
1 2 1 2
1 2 1 3
1 2 2 2
1 2 2 3
1 2 3 3
1 3 1 1
1 3 1 2
1 3 1 3
1 3 2 2
1 3 2 3
1 3 3 3
2 1 1 1
2 1 1 2
2 1 1 3
2 1 2 2
2 1 2 3
2 1 3 3
2 2 1 1
2 2 1 2
2 2 1 3
2 2 2 2
2 2 2 3
2 2 3 3
2 3 1 1
2 3 1 2
2 3 1 3
2 3 2 2
2 3 2 3
2 3 3 3
3 1 1 1
3...

output:

0
1
1
0
0
0
0
2
1
0
0
0
0
2
2
0
0
0
0
1
1
0
1
0
0
1
1
0
2
0
0
2
1
0
3
0
0
1
1
0
1
0
0
1
1
0
2
0
0
1
1
0
2
0

result:

wrong answer 1st lines differ - expected: '-1', found: '0'