Submission #1022149

# Submission time Handle Problem Language Result Execution time Memory
1022149 2024-07-13T10:33:06 Z edogawa_something Distributing Candies (IOI21_candies) C++17
8 / 100
73 ms 12880 KB
#include "candies.h"

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define pb push_back
#define F first 
#define S second 
const ll M=2e5+10;
ll pre[M];
vector<int> distribute_candies(vector<int>c,vector<int>l,vector<int>r,vector<int>v){
    vector<int>ans(c.size());
    for(int i=0;i<l.size();i++){
        pre[l[i]]+=v[i];
        pre[r[i]+1]-=v[i];
    }
    for(int i=1;i<=c.size();i++)
    pre[i]+=pre[i-1];
    for(int i=0;i<c.size();i++)
    ans[i]=min(ll(c[i]),pre[i]);
    return ans;
}

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<l.size();i++){
      |                 ~^~~~~~~~~
candies.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=1;i<=c.size();i++)
      |                 ~^~~~~~~~~~
candies.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i=0;i<c.size();i++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 73 ms 9044 KB Output is correct
2 Correct 68 ms 12880 KB Output is correct
3 Correct 68 ms 12880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -