QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96269#2928. Espresso!Abdelrahman_ahmed7#WA 2ms3372kbC++171.1kb2023-04-13 18:18:292023-04-13 18:18: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 18:18:32]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3372kb
  • [2023-04-13 18:18:29]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define el '\n'
#define all(a) a.begin(),a.end()

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<typename T>

using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll N=1e5+5,mod=1e9+7;


void solve(ll t) {
   int n,m;
   cin>>n>>m;
   int tmp=m;
   int sol=0;
   while(n--){
       string s;
       cin>>s;

       if(s.size()==1){
           if(tmp-(s[0]-'0')<0){
               sol++;
               tmp+=m;
               tmp-=(s[0]-'0');
           }
           else{
               tmp-=(s[0]-'0');
           }
       }
       else{
           if(tmp-(s[0]-'0')<0){
               sol++;
               tmp+=m;
               tmp-=(s[0]-'0')+1;
           }
           else{
               tmp-=(s[0]-'0')+1;
           }
       }
   }
   cout<<sol<<el;
}
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    ll t;
    //cin >> t;
    t = 1;
    for (ll i = 0 ; i < t ; i ++)
    {
        solve(t);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3340kb

input:

1 10
4L

output:

0

result:

ok single line: '0'

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3372kb

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'