Submission #3198759


Source Code Expand

/* Worldwide Combos, free and competitive block-stacking game! 
https://www.worldwide-combos.com */
 
#include<iostream>
#include<vector>
#include<array>
#include<string>
#include<sstream>
#include<map>
#include<unordered_map>
#include<chrono>
#include<set>
#include<unordered_set>
#include<ctime>
#include<bitset>
#include<queue>
#include<deque>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<random>
#include<cassert>
#include<complex>
#include<fstream>
#include<pthread.h>

#pragma GCC optimize "-O3"
#pragma GCC target "tune=native"
 
#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)
#define ford(i,n) for (int i = n-1; i >= 0; i--)
#define ford2(i,a,b) for (int i = b-1; i >= a; i--)
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626
#define EXP1 2.718281828459045
 
#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(iz,n) { scanf("%d", &t[iz]); }
#define sal(t,n) fin(iz,n) { scanf("%lld", &t[iz]); }
#define sad(t,n) fin(iz,n) { scanf("%lf", &t[iz]); }
 
#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define piii(n,m,k) printf("%d %d %d\n", n, m, k)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define plll(n,m,k) printf("%lld %lld %lld\n", n, m, k)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(rz,n) { printf("%d ", t[rz]); } printf("\n")
#define pal(t,n) fin(rz,n) { printf("%lld ", t[rz]); } printf("\n")
#define pad(t,n) fin(rz,n) { printf("%lf ", t[rz]); } printf("\n")
 
#define OK ps("OK")
#define OK1 ps("OK1")
#define OK2 ps("OK2")

#define L long long int
#define D double
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>
#define VD vector<D>
#define VVD vector<VD>
#define VVPII vector<VPII>
#define VC vector<char>

using namespace std;

int main() {
    //freopen("assessment.in", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,x;
    sii(n,x);
    int a[200];
    sai(a, n);
    int s = 0;
    sort(a, a+n);
    fin(i, n) {
        s += a[i];
        if (s > x) { pi(i); return 0; }
    }
    if (s == x) { pi(n); return 0; }
    pi(n-1); return 0;
    return 0; 
}

Submission Info

Submission Time
Task A - Candy Distribution Again
User noelnadal
Language C++14 (GCC 5.4.1)
Score 200
Code Size 2917 Byte
Status AC
Exec Time 1 ms
Memory 256 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:94:13: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     sii(n,x);
             ^
./Main.cpp:54:49: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define sai(t,n) fin(iz,n) { scanf("%d", &t[iz]); }
                                                 ^
./Main.cpp:96:5: note: in expansion of macro ‘sai’
     sai(a, n);
     ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 12
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt
Case Name Status Exec Time Memory
0_00.txt AC 1 ms 256 KiB
0_01.txt AC 1 ms 256 KiB
0_02.txt AC 1 ms 256 KiB
0_03.txt AC 1 ms 256 KiB
1_00.txt AC 1 ms 256 KiB
1_01.txt AC 1 ms 256 KiB
1_02.txt AC 1 ms 256 KiB
1_03.txt AC 1 ms 256 KiB
1_04.txt AC 1 ms 256 KiB
1_05.txt AC 1 ms 256 KiB
1_06.txt AC 1 ms 256 KiB
1_07.txt AC 1 ms 256 KiB