結果
| 問題 | No.8128 出力するだけなのに |
| コンテスト | |
| ユーザー |
npnp
|
| 提出日時 | 2026-04-01 22:39:41 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 500 ms |
| コード長 | 13,580 bytes |
| 記録 | |
| コンパイル時間 | 5,602 ms |
| コンパイル使用メモリ | 378,104 KB |
| 実行使用メモリ | 385,948 KB |
| 最終ジャッジ日時 | 2026-04-01 22:40:03 |
| 合計ジャッジ時間 | 20,331 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
//Compile Options
# pragma GCC target("avx2")
# pragma GCC optimize("O3")
# pragma GCC optimize("unroll-loops")
//libraries
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
//templates
// ---------- 基本 ----------
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vecll vector<ll>
#define vecpll vector<pll>
#define vecs vector<string>
#define cinvec(vec,type,size) vector<type> vec(size); for(ll i=0;i<size;i++) cin >> vec[i];
using i128 = __int128;
// ---------- for 系 ----------
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
// ---------- コンテナ操作 ----------
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
// ---------- sort ----------
#define srt(x) sort(all(x))
#define rsrt(x) sort(rall(x))
// ---------- vector ----------
#define sumall(x) std::reduce(all(x))
#define maxall(x) *max_element(all(x))
#define minall(x) *min_element(all(x))
// ---------- 出力補助 ----------
#define yes cout << "Yes\n"
#define no cout << "No\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define print(a) cout << (a) << endl
// その他
#define append push_back
//using Graph = vector<vector<int>>;
using pquell = priority_queue<ll>;
#define INFLL 1LL<<62
template <class T>
void println_decimal(T value, int digits) {
std::cout << std::fixed << std::setprecision(digits) << value << '\n';
}
//累積和
template <class T = long long>
struct CumulativeSum {
private:
// pref[i] = 先頭から i 個分の和
std::vector<T> pref;
ll mod;
ll m;
public:
CumulativeSum() {
pref.push_back(T(0)); // pref[0] = 0
m = 0;
}
CumulativeSum(ll M){
pref.push_back(T(0)); // pref[0] = 0
mod = M;
m = 1;
}
// 要素を末尾に追加
void push_back(T x) {
if(m){
pref.push_back((pref.back() + x)%mod);
}else{
pref.push_back(pref.back() + x);
}
}
// 区間 [l, r] の和を返す
T range_sum(int l, int r) const {
//assert(0 <= l && l <= r && r < (int)pref.size());
if (l<0 && r<0) return 0;
if (l>=(int)pref.size()-1) return 0;
if (l<0) l=0;
if (r>=(int)pref.size()-1) r=(int)pref.size()-2;
if(m){
return (pref[r+1] - pref[l]+mod)%mod;
}else{
return pref[r+1] - pref[l];
}
}
// 現在の要素数
int size() const {
return (int)pref.size() - 1;
}
};
#include <bits/stdc++.h>
using namespace std;
struct CumulativeSum2D {
int H, W;
vector<vector<long long>> sum;
// コンストラクタ
CumulativeSum2D(const vector<vector<long long>>& a) {
H = a.size();
W = (H ? a[0].size() : 0);
sum.assign(H + 1, vector<long long>(W + 1, 0));
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
sum[i+1][j+1] = a[i][j]
+ sum[i][j+1]
+ sum[i+1][j]
- sum[i][j];
}
}
}
// クエリ:左上(a,b), 右下(c,d) の長方形和(両端含む)
long long query(int a, int b, int c, int d) {
// 範囲外対応(クリップ)
int x1 = max(a, 0);
int y1 = max(b, 0);
int x2 = min(c, H - 1);
int y2 = min(d, W - 1);
// 完全に範囲外なら0
if (x1 > x2 || y1 > y2) return 0;
// 累積和計算
return sum[x2+1][y2+1]
- sum[x1][y2+1]
- sum[x2+1][y1]
+ sum[x1][y1];
}
};
//使い方
// CumulativeSum<long long> cs;
// cs.push_back(3);
// cs.push_back(5);
// cs.push_back(2);
// // [0,2] = 3+5+2
// cs.range_sum(0, 2); // 10
// // [-5,1] → [0,1]
// cs.range_sum(-5, 1); // 8
// // [2,10] → [2,2]
// cs.range_sum(2, 10); // 2
// // 完全に外
// cs.range_sum(5, 7); // 0
// const int N = 2*pow(10,4);
// vector<bool> isp(N+1, true);
// void sieve() {
// isp[0] = false;
// isp[1] = false;
// for (int i=2; pow(i,2)<=N; i++) {
// if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false;
// }
// }
//素因数分解
// const int N = 200000; // 必要に応じて変更
// vector<int> minp(N + 1);
//最小素因数の前計算
// void sieve_minp() {
// for (int i = 0; i <= N; i++) minp[i] = i;
// minp[0] = 0;
// minp[1] = 1;
// for (int i = 2; i * i <= N; i++) {
// if (minp[i] == i) { // i が素数
// for (int j = i * i; j <= N; j += i) {
// if (minp[j] == j) minp[j] = i;
// }
// }
// }
// }
// x の素因数分解を返す
// 戻り値: {素因数, 指数} の vector
// vector<pair<ll, ll>> pfWithMinp(ll x) {
// vector<pair<ll, ll>> res;
// while (x > 1) {
// ll p = minp[x];
// ll cnt = 0;
// while (x % p == 0) {
// x /= p;
// cnt++;
// }
// res.push_back({p, cnt});
// }
// return res;
// }
ll exp10(ll n){
ll ans= 1;
rep(i,n){
ans*=10;
}
return ans;
}
ll expo(ll a, ll b){
ll ans = 1;
rep(i,b){
ans*=a;
}
return ans;
}
unsigned GetDigit(unsigned num){
unsigned digit = 0;
while(num != 0){
num /= 10;
digit++;
}
return digit;
}
template <class T>
bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
struct triplet {
ll first, second, third;
// デフォルトコンストラクタ
triplet() : first(0), second(0), third(0) {}
triplet(ll a, ll b, ll c) : first(a), second(b), third(c) {}
// === 辞書順比較(std::sortでそのまま使える)===
bool operator<(const triplet& other) const {
if (first != other.first) return first < other.first;
if (second != other.second) return second < other.second;
return third < other.third;
}
// === 等価判定(set / map / 重複除去用)===
bool operator==(const triplet& other) const {
return first == other.first
&& second == other.second
&& third == other.third;
}
// === 各キー単体での比較用(ラムダ無しで使える)===
static bool cmp_first(const triplet& a, const triplet& b) {
return a.first < b.first;
}
static bool cmp_second(const triplet& a, const triplet& b) {
return a.second < b.second;
}
static bool cmp_third(const triplet& a, const triplet& b) {
return a.third < b.third;
}
// === pair / tuple 的に扱いたいとき用 ===
auto tie() const {
return std::tie(first, second, third);
}
};
template <class T>
class OffsetVector {
private:
int N; // 許可する最大絶対値
int offset; // 添字補正用
std::vector<T> data; // 実体
public:
// -N ~ N を許可
explicit OffsetVector(int N_, const T& init = T())
: N(N_), offset(N_), data(2 * N_ + 1, init) {}
// 添字アクセス(範囲チェックあり)
T& at(int idx) {
if (idx < -N || idx > N)
throw std::out_of_range("Index out of range");
return data[idx + offset];
}
const T& at(int idx) const {
if (idx < -N || idx > N)
throw std::out_of_range("Index out of range");
return data[idx + offset];
}
// 添字アクセス(範囲チェックなし)
T& operator[](int idx) {
return data[idx + offset];
}
const T& operator[](int idx) const {
return data[idx + offset];
}
int min_index() const { return -N; }
int max_index() const { return N; }
int size() const { return data.size(); }
};
constexpr std::string ToBaseN(unsigned long long n, const unsigned int base)
{
if ((base < 2) || (36 < base))
{
throw std::invalid_argument{ "base must be in the range [2, 36]." };
}
constexpr char Digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::string s;
do
{
s.push_back(Digits[n % base]);
n /= base;
} while (n);
std::ranges::reverse(s);
return s;
}
ll digrev(ll n){
string s = to_string(n);
ranges::reverse(s);
return stoll(s);
}
void merge_intervals(vector<pair<ll,ll>>& seg,
vector<pair<ll,ll>>& res){
if(seg.empty()) return;
sort(seg.begin(), seg.end());
ll L = seg[0].first;
ll R = seg[0].second;
for(int i = 1; i < seg.size(); i++){
if(seg[i].first > R){
res.push_back({L,R});
L = seg[i].first;
R = seg[i].second;
}else{
R = max(R, seg[i].second);
}
}
res.push_back({L,R});
}
// ll m;
// vector<ll> expd(100);
// void cal(){
// expd[0] = 10;
// for (ll i = 1;i<100;i++){
// expd[i] = (expd[i-1]*expd[i-1])%m;
// }
// }
// ll exp10mod(ll exp){
// ll c = exp;
// ll ret = 1;
// ll cur = 0;
// while(c){
// if(c&1)ret*=expd[cur];
// c/=2;
// ret%=m;
// cur++;
// }
// return ret;
// }
// ll m;
// ll A;
// vector<i128> expd(100);
// void cal(){
// expd[0] = A%m;
// for (ll i = 1;i<100;i++){
// expd[i] = (expd[i-1]*expd[i-1])%m;
// }
// }
// ll expAmod(ll exp){
// i128 c = exp;
// i128 ret = 1;
// i128 cur = 0;
// while(c){
// if(c&1)ret*=expd[cur];
// c/=2;
// ret%=m;
// cur++;
// }
// return (ll)ret;
// }
// #define pii pair<int,int>
// #define pll pair<ll,ll>
// #define vecll vector<ll>
// #define vecpll vector<pll>
// #define vecs vector<string>
// #define cinvec(vec,type,size) vector<type> vec(size); for(ll i=0;i<size;i++) cin >> vec[i];
/*セグ木用*/
// sum
ll op_sum(ll a, ll b) {
return a + b;
}
ll e_sum() {
return 0LL;
}
//max
ll op_max(ll a, ll b) {
return max(a, b);
}
ll e_max() {
return -(1LL<<60); // 十分小さい値
}
//min
ll op_min(ll a, ll b) {
return min(a, b);
}
ll e_min() {
return (1LL<<60); // 十分大きい値
}
//pllmax
pair<ll,ll> op_pair_max(pair<ll,ll> a, pair<ll,ll> b){
return max(a,b);
}
pair<ll,ll> e_pair_max(){
return {-1LL<<60, -1LL<<60};
}
//pllmin
pair<ll,ll> op_pair_min(pair<ll,ll> a, pair<ll,ll> b){
return min(a,b);
}
pair<ll,ll> e_pair_min(){
return {1LL<<60, 1LL<<60};
}
// typedef segtree<ll, op_max, e_max> sgmaxll ;
// typedef segtree<ll, op_min, e_min> sgminll ;
// typedef segtree<ll, op_sum, e_sum> sgsumll ;
// typedef segtree<pair<ll,ll>, op_pair_max, e_pair_max> sgmaxpll ;
// typedef segtree<pair<ll,ll>, op_pair_min, e_pair_min> sgminpll ;
//ワーシャルフロイド(参照渡し)
void warshall_floyd(vector<vector<ll>>& c){
ll N = c.size();
rep(k,N){
rep(i,N){
rep(j,N){
c[i][j] = min(c[i][j],c[i][k]+c[k][j]);
}
}
}
}
long long iphi(long long r){
__int128 x = (__int128)5 * r * r;
long long s = sqrtl((long double)x); // 初期値
while((__int128)(s+1)*(s+1) <= x) s++;
while((__int128)s*s > x) s--;
return (r + s) / 2;
}
struct mint {
static const long long MOD = 998244353;
long long v;
mint(long long _v = 0) {
v = _v % MOD;
if (v < 0) v += MOD;
}
// 加算
mint& operator+=(const mint& o) {
v += o.v;
if (v >= MOD) v -= MOD;
return *this;
}
// 減算
mint& operator-=(const mint& o) {
v -= o.v;
if (v < 0) v += MOD;
return *this;
}
// 乗算
mint& operator*=(const mint& o) {
v = (v * o.v) % MOD;
return *this;
}
// 累乗
static mint pow(mint a, long long e) {
mint r = 1;
while (e) {
if (e & 1) r *= a;
a *= a;
e >>= 1;
}
return r;
}
// 逆元
mint inv() const {
return pow(*this, MOD - 2);
}
// 除算
mint& operator/=(const mint& o) {
return (*this) *= o.inv();
}
friend mint operator+(mint a, const mint& b) { return a += b; }
friend mint operator-(mint a, const mint& b) { return a -= b; }
friend mint operator*(mint a, const mint& b) { return a *= b; }
friend mint operator/(mint a, const mint& b) { return a /= b; }
bool operator==(const mint& o) const { return v == o.v; }
bool operator!=(const mint& o) const { return v != o.v; }
friend ostream& operator<<(ostream& os, const mint& m) {
return os << m.v;
}
};
/*
ここから下がsolve
*/
int main() {
ll N;
cin >> N;
const char *str = "Hello world!\n";
// 文字列を1文字ずつ標準出力へ出力
rep(i,N){
for (int i = 0; i < strlen(str); i++) {
// stdoutは標準出力ストリーム
putc_unlocked(str[i], stdout);
}
}
}
/*
・オーバーフロー注意!!
・浮動小数点の誤差に注意!!(掛け算して比較推奨・比較するときにi64超えてない?)
・お前そのmultiset本当に必要?(vector推奨)
・グラフビジュアライザー(https://gemini.google.com/share/6a5c1ef7af18)
・mint::pow
*/
npnp