QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#726009 | #2928. Espresso! | zeyu# | WA | 0ms | 3616kb | C++23 | 2.0kb | 2024-11-08 21:14:28 | 2024-11-08 21:14:28 |
Judging History
answer
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pl pair<ll, ll>
#define pi pair<int, int>
#define minpq priority_queue<ll, vector<ll>, greater<ll>>
using namespace std;
#if 1
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '['; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "]";}
void _print() {cerr << endl << flush;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "*["<<__LINE__<<"]\t"<< #x << " = "; _print(x)
#endif
const ll mod = 1e9 + 7;
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll gcd(ll a, ll b) {if(b == 0){return a;} return gcd(b, a % b);}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, s; cin >> n >> s;
int cur = s;
int ans = 0;
for (int i = 0; i < n; i ++){
string t; cin >> t;
if (t.size() == 1){
if (cur < t[0] - '0' + 1){
cur = s;
ans ++;
}
cur -= t[0] - '0' + 1;
} else{
if (cur < t[0] - '0'){
cur = s;
ans ++;
}
cur -= t[0] - '0';
}
}
cout << ans << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
1 10 4L
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
15 10 3 2L 3 1 3 2L 3 4 3L 2L 3 1 4 2 4L
output:
5
result:
ok single line: '5'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
8 24 1 1L 2 2L 3 3L 4 4L
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
8 24 1 3L 4 4L 2L 3 2 1L
output:
0
result:
ok single line: '0'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3596kb
input:
100 10 3 3L 3 1 3 4 2 4L 2L 3L 3L 3 2L 1 3 4 3L 3L 2L 1 3L 2 3 3 3L 3 1 4 1L 4 2 4 3L 3 1L 2 1L 4 4 3L 4 3L 1L 1L 1 3 2 1L 3 1L 3 4L 4L 3L 4 1L 2L 2 4 1 2 1 4L 3L 1L 2L 3 2L 1L 2L 2L 3 2L 2 3L 3L 4L 1 2L 3L 4 3 3L 4L 4 3 4L 1 2 2 3L 2 1L 4 3L 4 1 3L 4 1L
output:
36
result:
wrong answer 1st lines differ - expected: '34', found: '36'