Submission #69643109


Source Code Expand

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#ifdef jlocal
#include<jdebug/debug.hpp>
#else
#define debug(...) 0;
#endif

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#if defined(__LP64__) || defined(_WIN64)
typedef __int128 lll;
#else
typedef long long lll;
#endif

#define pcount(x) __builtin_popcount(x)
#define pcountll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()

const ld pi = 3.14159265358979323846L;
const ld sqrt2 = 1.41421356237309504880L;

template<class T>
istream& operator>>(istream& in, vector<T> &a){
	for (int i = 0; i < a.size(); i ++)
		in >> a[i];
	return in;
}

template<class T>
ostream& operator<<(ostream& out, vector<T> &a){
	for (int i = 0; i < a.size(); i ++){
		if (i > 0) out << ' ';
		out << a[i];
	}
	return out;
}

#if defined(__LP64__) || defined(_WIN64)

istream& operator>>(istream& in, __int128 &x){
	string S;
	in >> S;
	for (char &y : S){
		x *= 10;
		x += (y - '0');
	}
	return in;
}

ostream& operator<<(ostream& out, __int128 &x){
	string s;
	while(x > 0){
		s.push_back((x % 10) + '0');
		x /= 10;
	}
	if (s.size() == 0)
		s.push_back('0');
	reverse(all(s));
	return out << s;
}

#endif

mt19937_64 MT64;
void pre_init() {
	MT64 = mt19937_64(chrono::system_clock::now().
	time_since_epoch().count());
}

void solve(int caso){
	int n;
	cin >> n;
	ll sum = 0;
	for (int i = 1; i <= n; i ++){
		int valor = 1;
		if (i % 2 == 1)
			valor = -1;
		sum += valor * i * i * i;
	}
	cout << sum << '\n';
}

int main(){
#ifndef jlocal
	ios::sync_with_stdio(0); cin.tie(0);
#endif
	pre_init();

	int t = 1;
	for (int i = 1; i <= t; i ++){
		solve(i);
	}
	return 0;
}

Submission Info

Submission Time
Task A - Sigma Cubes
User JOliva
Language C++ 20 (gcc 12.2)
Score 100
Code Size 2044 Byte
Status AC
Exec Time 1 ms
Memory 3616 KiB

Compile Error

Main.cpp: In function ‘void solve(int)’:
Main.cpp:82:16: warning: unused parameter ‘caso’ [-Wunused-parameter]
   82 | void solve(int caso){
      |            ~~~~^~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 10
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3492 KiB
00_sample_01.txt AC 1 ms 3480 KiB
00_sample_02.txt AC 1 ms 3616 KiB
01_random_00.txt AC 1 ms 3444 KiB
01_random_01.txt AC 1 ms 3612 KiB
01_random_02.txt AC 1 ms 3488 KiB
01_random_03.txt AC 1 ms 3488 KiB
01_random_04.txt AC 1 ms 3408 KiB
01_random_05.txt AC 1 ms 3540 KiB
01_random_06.txt AC 1 ms 3468 KiB