提出 #57962631


ソースコード 拡げる

#include <bits/stdc++.h>
#define st first
#define nd second
#define db double
#define re register
#define pb push_back
#define mk make_pair
#define int long long
#define ldb long double
#define pii pair<int, int>
#define ull unsigned long long
#define mst(a, b) memset(a, b, sizeof(a))
using namespace std;
const int N = 2e5 + 10, mod = 998244353; 
inline int read()
{
  int s = 0, w = 1;
  char ch = getchar();
  while(ch < '0' || ch > '9') { if(ch == '-') w *= -1; ch = getchar(); }
  while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
inline int add(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
inline int dec(int x, int y) { return x - y < 0 ? x - y + mod : x - y; }
int cnt, ck[N];
signed main()
{
  int m = read(), p = 0;
  while(m){
    int lv = m % 3;
    while(lv--) ck[++cnt] = p;
    m /= 3, p++;
  }
  printf("%lld\n", cnt);
  for(re int i = 1; i <= cnt; i++) printf("%lld ", ck[i]); 
  return 0;
}

提出情報

提出日時
問題 B - 3^A
ユーザ Booksnow
言語 C++ 20 (gcc 12.2)
得点 200
コード長 998 Byte
結果 AC
実行時間 1 ms
メモリ 3808 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:35:14: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   35 |   for(re int i = 1; i <= cnt; i++) printf("%lld ", ck[i]);
      |              ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 51
セット名 テストケース
Sample 00_sample_100.txt, 00_sample_59048.txt, 00_sample_6.txt
All 00_sample_100.txt, 00_sample_59048.txt, 00_sample_6.txt, 01_small_1.txt, 01_small_10.txt, 01_small_11.txt, 01_small_2.txt, 01_small_3.txt, 01_small_4.txt, 01_small_5.txt, 01_small_7.txt, 01_small_8.txt, 01_small_9.txt, 02_large_39365.txt, 02_large_52487.txt, 02_large_56861.txt, 02_large_58319.txt, 02_large_58805.txt, 02_large_58967.txt, 02_large_59021.txt, 02_large_59039.txt, 02_large_59045.txt, 02_large_98414.txt, 03_handmade_100000.txt, 03_handmade_78732.txt, 03_handmade_98409.txt, 03_handmade_98412.txt, 03_handmade_98413.txt, 03_handmade_98415.txt, 03_handmade_99144.txt, 03_handmade_99870.txt, 03_handmade_99871.txt, 03_handmade_99872.txt, 03_handmade_99873.txt, 03_handmade_99953.txt, 03_handmade_99954.txt, 03_handmade_99981.txt, 03_handmade_99990.txt, 03_handmade_99997.txt, 03_handmade_99998.txt, 03_handmade_99999.txt, 04_random_11273.txt, 04_random_16808.txt, 04_random_27545.txt, 04_random_37710.txt, 04_random_43659.txt, 04_random_50074.txt, 04_random_50879.txt, 04_random_75250.txt, 04_random_77924.txt, 04_random_8931.txt
ケース名 結果 実行時間 メモリ
00_sample_100.txt AC 1 ms 3744 KiB
00_sample_59048.txt AC 1 ms 3744 KiB
00_sample_6.txt AC 1 ms 3748 KiB
01_small_1.txt AC 1 ms 3564 KiB
01_small_10.txt AC 1 ms 3612 KiB
01_small_11.txt AC 1 ms 3748 KiB
01_small_2.txt AC 1 ms 3748 KiB
01_small_3.txt AC 1 ms 3688 KiB
01_small_4.txt AC 1 ms 3660 KiB
01_small_5.txt AC 1 ms 3656 KiB
01_small_7.txt AC 1 ms 3580 KiB
01_small_8.txt AC 1 ms 3616 KiB
01_small_9.txt AC 1 ms 3564 KiB
02_large_39365.txt AC 1 ms 3624 KiB
02_large_52487.txt AC 1 ms 3744 KiB
02_large_56861.txt AC 1 ms 3656 KiB
02_large_58319.txt AC 1 ms 3572 KiB
02_large_58805.txt AC 1 ms 3620 KiB
02_large_58967.txt AC 1 ms 3748 KiB
02_large_59021.txt AC 1 ms 3564 KiB
02_large_59039.txt AC 1 ms 3624 KiB
02_large_59045.txt AC 1 ms 3660 KiB
02_large_98414.txt AC 1 ms 3688 KiB
03_handmade_100000.txt AC 1 ms 3688 KiB
03_handmade_78732.txt AC 1 ms 3656 KiB
03_handmade_98409.txt AC 1 ms 3584 KiB
03_handmade_98412.txt AC 1 ms 3592 KiB
03_handmade_98413.txt AC 1 ms 3744 KiB
03_handmade_98415.txt AC 1 ms 3748 KiB
03_handmade_99144.txt AC 1 ms 3656 KiB
03_handmade_99870.txt AC 1 ms 3684 KiB
03_handmade_99871.txt AC 1 ms 3768 KiB
03_handmade_99872.txt AC 1 ms 3580 KiB
03_handmade_99873.txt AC 1 ms 3624 KiB
03_handmade_99953.txt AC 1 ms 3752 KiB
03_handmade_99954.txt AC 1 ms 3624 KiB
03_handmade_99981.txt AC 1 ms 3808 KiB
03_handmade_99990.txt AC 1 ms 3628 KiB
03_handmade_99997.txt AC 1 ms 3576 KiB
03_handmade_99998.txt AC 1 ms 3768 KiB
03_handmade_99999.txt AC 1 ms 3748 KiB
04_random_11273.txt AC 1 ms 3656 KiB
04_random_16808.txt AC 1 ms 3696 KiB
04_random_27545.txt AC 1 ms 3744 KiB
04_random_37710.txt AC 1 ms 3564 KiB
04_random_43659.txt AC 1 ms 3744 KiB
04_random_50074.txt AC 1 ms 3748 KiB
04_random_50879.txt AC 1 ms 3764 KiB
04_random_75250.txt AC 1 ms 3744 KiB
04_random_77924.txt AC 1 ms 3688 KiB
04_random_8931.txt AC 1 ms 3684 KiB