提出 #66932052
ソースコード 拡げる
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(c) c.begin(), c.end()
#define ll long long
#define tr(a, it) for (auto it = a.begin(); it != a.end(); it++)
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c), x) != c.end())
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vvll vector<vll>
#define vpii vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define pll pair<ll, ll>
#define inf 1e9
#define MOD 1000000007
#define MAXN 10000
#define infi 1e18
#define moda 998244353
#define loop(i, s, e) for (ll i = s; i < e; i++)
#define revloop(i, s, e) for (ll i = s; i >= e; i--)
#define newl cout << endl
#define pb push_back
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef DEBUG_H
#define DEBUG_H
#define debug(x) \
cout << #x << " "; \
_print(x); \
cout << '\n';
void _print(int x) { cout << x; }
void _print(char x) { cout << x; }
void _print(double x) { cout << x; }
void _print(string s) { cout << s; }
void _print(uint64_t s) { cout << s; }
void _print(long long x) { cout << x; }
void _print(bool a) { cout << a; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T>
void _print(priority_queue<T> v);
template <class T>
void _print(deque<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
cout << "{";
_print(p.first);
cout << ",";
_print(p.second);
cout << "}" << endl;
}
template <class T>
void _print(priority_queue<T> pq) {
cout << "[ ";
while (!pq.empty()) {
_print(pq.top());
pq.pop();
cout << " ";
}
cout << "]" << endl;
}
template <class T>
void _print(deque<T> dq) {
cout << "[ ";
while (!dq.empty()) {
_print(dq.front());
dq.pop_front();
cout << " ";
}
cout << "]" << endl;
}
template <class T>
void _print(queue<T> q) {
cout << "[ ";
while (!q.empty()) {
_print(q.front());
q.pop();
cout << " ";
}
cout << "]" << endl;
}
template <class T>
void _print(vector<T> v) {
cout << "[ ";
for (T i : v) {
_print(i);
cout << " ";
}
cout << "]" << endl;
}
template <class T>
void _print(set<T> st) {
cout << "[ ";
for (T i : st) {
_print(i);
cout << " ";
}
cout << "]" << endl;
}
template <class T>
void _print(multiset<T> v) {
cout << "[ ";
for (T i : v) {
_print(i);
cout << " ";
}
cout << "]" << endl;
}
template <class T, class V>
void _print(map<T, V> v) {
cout << "[ ";
for (auto i : v) {
_print(i);
cout << " ";
}
cout << "]" << endl;
}
#endif // DEBUG_H
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ll gcd(ll a, ll b){
if(!(a%b)) return b;
return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
return (a*b)/gcd(a,b);
}
ll MSB(ll n){
ll ans = 0;
while(n){
ans++;
n /= 2;
}
return ans;
}
ll power(ll a, ll b, ll mod) { // to calculate (a^b)%mod
ll p = 1;
while (b > 0) {
if (b & 1)
p = (p * a) % mod;
a = (a * a) % mod;
b = b >> 1;
}
return p;
}
ll inv_mod(ll n, ll mod) {
return power(n, mod - 2, mod);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void solve(int tc) {
int n; cin >> n;
vi d(n - 1); loop(i,0,n - 1) cin >> d[i];
for(int i = 0; i < n; i++){
int cur = 0;
for(int j = i + 1; j < n; j++){
cur += d[j - 1];
cout << cur << ' ';
}
cout << '\n';
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int t; t = 1;
// cin >> t;
int tc = 0;
while (t--) {
tc++;
solve(tc);
}
return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
B - Distance Table |
| ユーザ |
arikrrr77 |
| 言語 |
C++ 20 (gcc 12.2) |
| 得点 |
200 |
| コード長 |
4777 Byte |
| 結果 |
AC |
| 実行時間 |
1 ms |
| メモリ |
3536 KiB |
コンパイルエラー
Main.cpp: In function ‘void solve(int)’:
Main.cpp:182:16: warning: unused parameter ‘tc’ [-Wunused-parameter]
182 | void solve(int tc) {
| ~~~~^~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
200 / 200 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
example_00.txt, example_01.txt |
| All |
example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| example_00.txt |
AC |
1 ms |
3480 KiB |
| example_01.txt |
AC |
1 ms |
3464 KiB |
| hand_00.txt |
AC |
1 ms |
3416 KiB |
| hand_01.txt |
AC |
1 ms |
3468 KiB |
| hand_02.txt |
AC |
1 ms |
3472 KiB |
| hand_03.txt |
AC |
1 ms |
3388 KiB |
| hand_04.txt |
AC |
1 ms |
3536 KiB |
| random_00.txt |
AC |
1 ms |
3468 KiB |
| random_01.txt |
AC |
1 ms |
3476 KiB |
| random_02.txt |
AC |
1 ms |
3472 KiB |
| random_03.txt |
AC |
1 ms |
3320 KiB |
| random_04.txt |
AC |
1 ms |
3480 KiB |
| random_05.txt |
AC |
1 ms |
3320 KiB |
| random_06.txt |
AC |
1 ms |
3468 KiB |
| random_07.txt |
AC |
1 ms |
3416 KiB |
| random_08.txt |
AC |
1 ms |
3476 KiB |
| random_09.txt |
AC |
1 ms |
3412 KiB |