QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96208#2928. Espresso!Eiad_Ahmed#WA 2ms3380kbC++171.6kb2023-04-13 17:08:312023-04-13 17:08:32

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 17:08:32]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3380kb
  • [2023-04-13 17:08:31]
  • 提交

answer

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define fa ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
typedef long long ll;
typedef long double ld;
typedef double d;
typedef unsigned long long ull;
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using orderedset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


template<typename T = ll>
istream &operator>>(istream &in, vector<T> &v) {
    for (auto &x: v) in >> x;
    return in;
}

template<typename T = ll>
ostream &operator<<(ostream &out, const vector<T> &v) {
    for (const T &x: v) out << x << ' ';
    return out;
}


signed main() {
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
    freopen("o.txt", "w", stdout);
#endif
    fa

    ll T = 1, k;
   // cin >> T;

    while (T--) {

        int n, m;
        cin >> n >> m;

        int tot = 0;

        int temp = m;
        int ans = 0;
        for (int i = 0; i < n; i++) {
            string s;
            cin >> s;

            if (s.size() == 2) {

                if (temp - (s[0] - '0')+1 < 0) {
                    temp = m;
                    ans++;
                }
                temp -= (s[0] - '0')+1;

            } else {

            if (temp - (s[0] - '0') < 0) {
                temp = m;
                ans++;
            }
            temp -= (s[0] - '0');
        }
        }

        cout << ans << endl;
    }


}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3344kb

input:

1 10
4L

output:

0

result:

ok single line: '0'

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3380kb

input:

15 10
3
2L
3
1
3
2L
3
4
3L
2L
3
1
4
2
4L

output:

4

result:

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