QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96200 | #2928. Espresso! | mariam# | AC ✓ | 3ms | 3460kb | C++17 | 2.4kb | 2023-04-13 16:58:45 | 2023-04-13 16:58:46 |
Judging History
answer
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <set>
#include <unordered_set>
#include <queue>
#include <map>
#include <cmath>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <stdio.h>
#include <stack>
#include <list>
#include "complex"
#include <assert.h>
#define el '\n'
#define ll long long
#define ld long double
using namespace std;
//
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//
//using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const int N = 2e5 + 5, mod = 1e9 + 7, MAX = 1e9 + 1, M = 1e5;
long double PI = 3.14159265358979323846;;
#define point complex<long double>
#define vec(a, b) b-a
#define dot(a, b) (long double)(conj(a)*b).real()
#define cross(a, b) (long double)(conj(a)*b).imag()
#define length(a) (hypot((a).imag(), (a).real()))
#define angle(a) atan2((a).imag(), (a).real())
int h, w;
//char a[201][201];
//int dx[] = {0, 0, -1, 1, 1, -1, -1, 1}, dy[] = {-1, 1, 0, 0, 1, -1, 1, -1};
//int dx[] = {-1, -1, 0, 0, 1, 1}, dy[] = {-1, 0, -1, 1, 0, 1};
//
//bool valid(int i, int j) {
// return (i < h && i >= 0 && j < w && j >= 0);
//}
//
//bool vis[201][201];
ll mul(ll a, ll b) {
return ((a % mod) * (b % mod)) % mod;
}
ll add(ll a, ll b) {
return ((a % mod) + (b % mod)) % mod;
}
ll sub(ll a, ll b) {
return ((((a + mod) % mod) - ((b + mod) % mod)) + mod) % mod;
}
ll fastpow(ll b, ll p) {
if (p == 0)
return 1;
if (p == 1) {
return b;
}
ll hp = fastpow(b, p / 2);
ll ans = ((hp % mod) * (hp % mod)) % mod;
if (p % 2) {
ans = (ans * b) % mod;
}
return ans % mod;
}
void m() {
int n, s;
cin >> n >> s;
int ans = 0, curr = s;
while(n--){
string x;
cin >> x;
int cost;
if(x.size() == 1)
cost = (x[0] - '0');
else
cost = (x[0] - '0') + 1;
if(cost > curr){
curr = s;
ans++;
}
curr -= cost;
}
cout << ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
m();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3360kb
input:
1 10 4L
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3380kb
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: 2ms
memory: 3344kb
input:
8 24 1 1L 2 2L 3 3L 4 4L
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3456kb
input:
8 24 1 3L 4 4L 2L 3 2 1L
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3344kb
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:
34
result:
ok single line: '34'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3340kb
input:
100 11 3L 3L 3 2 3L 1L 2 3L 2 3 3 4 1 3 1L 2L 2L 4 2L 4L 2L 4 3 4L 4 2L 2 4L 3L 2L 3 1L 4L 2L 2L 1 2L 1 1 1L 1L 1L 2 1L 2 2 3L 1L 1 4L 4 3L 2L 4 4L 4 4 2L 3 2L 1 2L 2L 2L 2L 4L 4 3 4L 1L 2 4 1L 2L 4 2 1 2 3 4 2L 1 3L 1L 3 3L 1L 2 4 1L 3L 1 4L 4L 3L 2 1L 3L 2L 2L
output:
31
result:
ok single line: '31'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
100 12 1 2 1L 4 3L 3 2L 4L 1L 3 4L 3L 1 1L 4 2L 3L 4L 4 3L 1L 4 1L 4L 3L 1L 2 4 1 2 3 2L 4 2L 2 2L 4 2 4 3 4 2L 4L 2 1 4L 2L 2 3 2 1L 2L 4 3 2 1 2 4 1L 1L 4L 1L 1 1L 1 2 1L 4L 1 3 1L 3L 4 4L 1 1 4L 1L 2L 2L 2L 2L 1 2 1L 3 2L 4L 4 3 1L 1 4 4 4 3L 4 4 1L 1L
output:
27
result:
ok single line: '27'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
100 13 1L 2L 2 2 4L 2 4 3L 2L 4L 4L 2 1 3 4 3 1 2L 2L 4 4 3 2 3L 3 4L 3L 1 4 2 4 2 4L 4L 2 2L 2L 2L 4L 2L 4L 1 4 2L 3 1L 1L 4L 4 4L 3 1L 1L 2 4 4L 2L 1 1 3 1L 4L 1 2L 2 1L 2L 2L 1 2 2L 3L 3L 2L 3 3 4L 4 4L 4L 3 4L 4 3 1L 3 4 2L 4L 2 2 3L 3L 3 4L 4L 3L 1 2L 3L
output:
27
result:
ok single line: '27'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3344kb
input:
100 15 1 4 3 2 4L 3L 1L 4 3L 3L 2 2L 1L 4L 3L 4L 1 2 3 2 2L 2 4 2 4L 1L 3 2 1L 1 2L 3 2L 1L 4 1 2L 1L 3L 4L 3L 1L 2L 3L 2L 4L 1L 1L 1L 1L 3 1L 4 3L 3 1 2 3L 4 4L 1 3 1L 4 1L 2L 1L 4 4L 4L 3L 1L 2 2 4L 1L 3L 4 1L 2 1L 3L 3 4L 2L 1 4L 2 4L 3L 4 1 4 4 4 3L 4 3L 2L 3
output:
22
result:
ok single line: '22'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3364kb
input:
100 17 2 3L 1L 1L 3 2L 4 3 1L 2 3L 3 3L 2L 1 2L 3L 3 2 1L 4L 1L 3 3 4 1 2L 3L 1 2 1L 4 3 3L 3L 1L 4 2 4 2 3L 3L 1 1L 3L 4 3 2L 1L 2 2 1L 2L 1 3L 3 4 4 2L 1 2L 1 3 4L 2 4L 4L 2L 3 3 4L 4L 3L 4L 1 4L 3L 1L 3L 2 4L 1L 1L 2L 3L 2L 3L 1 2L 3 2 4L 4 1 3L 1L 4 4 2 3L
output:
19
result:
ok single line: '19'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3296kb
input:
100 24 1 3 2 4 1 4 2 1L 1L 4 2 1 3L 2L 3 2L 1 1 1 1L 3 1L 2L 3L 1L 4 4 2 3 3L 1 3L 2 2 2L 4L 4L 4L 2L 1L 4 3L 4L 3 4 4L 2 3 2 4L 2L 3L 1 3L 4 1L 1L 3L 4L 4L 2 1 2 4 3 3 3L 2L 2L 4 1 4L 2L 4L 3L 4 4 1L 4L 1 1 2 4L 2 1L 4L 3L 3 4 4 4L 3 2L 2L 3 2L 1L 3 3 1
output:
13
result:
ok single line: '13'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3456kb
input:
100 131 1 1L 2 2L 1 4L 3L 3L 3L 4 2 3 3 1L 3 3 1 3L 3L 4L 2 3 2 1L 2 4 4L 4L 3 3 4L 3 2 3 2L 4L 4L 4 3L 4L 2 3L 2 3 4 1L 1 2 2L 3L 4L 3 3L 3L 1 1L 3L 3 4 3L 2 1 4L 2 3L 1 1 2 4 1 1 4L 4L 2L 3L 3 3 4L 3L 4L 4 4L 1 3 1 4L 4 3 4L 3L 4L 2 4 4 4L 1L 1L 4 3L 2
output:
2
result:
ok single line: '2'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3368kb
input:
100 200 2 2 2L 1 1L 3L 1L 1L 1 3L 2L 3L 3 1 2L 2L 2L 4 1L 3L 1L 2 3L 3 2 3 4 2L 2 2L 1 3L 3 2L 3L 3 4L 4 1 1L 4L 1L 2L 1 2L 4L 1 3 4L 4L 1L 2 4 2 4L 3L 3L 2L 3 3 3L 3L 4L 4 3 3L 4L 3L 1L 4 1 4L 1 1 4L 2L 2 2 4L 1L 1 3L 4L 3 2L 2L 4 2L 3L 4L 4 2 4L 1 1L 4L 4L 1 1L 1
output:
1
result:
ok single line: '1'
Test #14:
score: 0
Accepted
time: 3ms
memory: 3460kb
input:
8 10 1 2L 3 4 3L 1 1L 4L
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
3 12 4 4 4
output:
0
result:
ok single line: '0'