提出 #49474152


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

// define
#define re register
#define fi first
#define se second
#define il inline
#define co const
#define ls (u << 1)
#define rs (u << 1 | 1)
#define fup(x, l, r) for (re int x = (l), eNd = (r); x <= eNd; ++ x )
#define fdw(x, r, l) for (re int x = (r), eNd = (l); x >= eNd; -- x )
//#define int long long

// typedef
typedef pair<int, int> PII;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

// const
const int N = 1e6 + 10, M = 2e6 + 10;
const int INF = 2e9, P = 998244353;
const double eps = 1e-6;

// debug
const bool DeBug = true;
int db_cnt;
il void db() { if (DeBug) puts("--------------"); return; }
il void db(auto a) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << '\n'; return; }
il void db(auto a, auto b) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << ", " << b << '\n'; return; }
il void db(auto a, auto b, auto c) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << ", " << b << ", " << c << '\n'; return; }
il void db(auto a, auto b, auto c, auto d) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << ", " << b << ", " << c << ", " << d << '\n'; return; }
il void db(auto a, auto b, auto c, auto d, auto e) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << ", " << b << ", " << c << ", " << d << ", " << e << '\n'; return; }
il void db(auto *a, auto *b) { if (DeBug) { ++ db_cnt; cout << "-- | t" << db_cnt << " : {"; if (a >= b) cout << "empty"; else { cout << (*a); for (auto *i = a + 1; i < b; ++ i ) cout << ", " << *i; } cout << "}\n"; } return; }

// common functions
il int Max(co auto a, co auto b) { return a > b ? a : b; }
il int Min(co auto a, co auto b) { return a < b ? a : b; }
il LL read() { re LL x = 0; re bool f = true; re char c = getchar(); while (c < 48 || c > 57) { (c == '-') ? f = false : 0; c = getchar(); } while (c > 47 && c < 58) x = (x << 3) + (x << 1) + c - 48, c = getchar(); return f ? x : -x; }
il void read(auto *a, auto *b) { for (auto *i = a; i < b; ++ i ) *i = read(); return; }
il void write(re auto x) { (x < 0) ? putchar('-'), x = -x : 0; (x > 9) ? write(x / 10) : void(); putchar(x % 10 + 48); return; }
il void wel(co auto x) { write(x), putchar('\n'); return; }
il void wel(co auto x, co auto y) { write(x), putchar(' '), write(y), putchar('\n'); return; }
il void wel(co auto x, co auto y, co auto z) { write(x), putchar(' '), write(y), putchar(' '), write(z), putchar('\n'); return; }
il void wsp(co auto x) { write(x), putchar(' '); return; }
il void wel(auto *a, auto *b) { for (auto *i = a; i < b; ++ i ) wsp(*i); puts(""); return; }
il void wel(vector<auto> v) { for (auto i : v) wsp(i); puts(""); return; }

int n;
char s[N];

signed main()
{
	cin >> n;
	
	if (n == 2)
	{
		cout << 1 << endl << 1 << ' ' << 1 << endl;
		cin >> s[1];
		if (s[1] == '1') cout << 1 << endl;
		else cout << 2 << endl;
		return 0;
	}
	
	cout << n - 1 << endl;
	fup (i, 2, n)
		cout << 2 << ' ' << i - 1 << ' ' << i << endl;
	
	scanf("%s", s + 1);
	
	fup (i, 1, n - 1)
		if (s[i] == '1')
		{
			cout << i << endl;
			return 0; 
		}
	
	return 0;
}

提出情報

提出日時
問題 E - Bad Juice
ユーザ huk2
言語 C++ 20 (gcc 12.2)
得点 0
コード長 3246 Byte
結果 WA
実行時間 3 ms
メモリ 3848 KiB

コンパイルエラー

Main.cpp: In function ‘LL read()’:
Main.cpp:42:22: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   42 | il LL read() { re LL x = 0; re bool f = true; re char c = getchar(); while (c < 48 || c > 57) { (c == '-') ? f = false : 0; c = getchar(); } while (c > 47 && c < 58) x = (x << 3) + (x << 1) + c - 48, c = getchar(); return f ? x : -x; }
      |                      ^
Main.cpp:42:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   42 | il LL read() { re LL x = 0; re bool f = true; re char c = getchar(); while (c < 48 || c > 57) { (c == '-') ? f = false : 0; c = getchar(); } while (c > 47 && c < 58) x = (x << 3) + (x << 1) + c - 48, c = getchar(); return f ? x : -x; }
      |                                     ^
Main.cpp:42:55: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   42 | il LL read() { re LL x = 0; re bool f = true; re char c = getchar(); while (c < 48 || c > 57) { (c == '-') ? f = false : 0; c = getchar(); } while (c > 47 && c < 58) x = (x << 3) + (x << 1) + c - 48, c = getchar(); return f ? x : -x; }
      |                                                       ^
Main.cpp: At global scope:
Main.cpp:44:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   44 | il void write(re auto x) { (x < 0) ? putchar('-'), x = -x : 0; (x > 9) ? write(x / 10) : void(); putchar(x % 10 + 48); return; }
      |                       ^
Main.cpp: In function ‘int main()’:
Main.cpp:69:14: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   69 |         fup (i, 2, n)
      |              ^
Main.cpp:13:34: note: in definition of macro ‘fup’
   13 | #define fup(x, l, r) for (re int x = (l), eNd = (r); x <= eNd; ++ x )
      |                                  ^
Main.cpp:13:43: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   13 | #define fup(x, l, r) for (re int x = (l), eNd = (r); x <= eNd; ++ x )
      |                                           ^~~
Main.cpp:69:9: note: in expansion of macro ‘fup’
   69 |         fup (i, 2, n)
      |         ^~~
Main.cpp:74:14: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   74 |         fup (i, 1, n - 1)
      |              ^
Main.cpp:13:34: note: in definition of macro ‘fup’
   13 | #define fup(x, l, r) for (re int x = (l), eNd = (r); x <= eNd; ++ x )
      |                                  ^
Main.cpp:13:43: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   13 | #define fup(x, l, r) for (re int x = (l), eNd = (r); x <= eNd; ++ x )
      |                                           ^~~
Main.cpp:74:9: note: in expansion of macro ‘fup’
   74 |         fup (i, 1, n - 1)
      |         ^~~
Main.cpp:72:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   72 |         scanf("%s", s + 1);
      |         ~~~~~^~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 425
結果
AC × 1
AC × 4
WA × 22
セット名 テストケース
Sample example0.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, example0.txt
ケース名 結果 実行時間 メモリ
000.txt AC 2 ms 3752 KiB
001.txt AC 2 ms 3812 KiB
002.txt AC 2 ms 3848 KiB
003.txt WA 2 ms 3748 KiB
004.txt WA 2 ms 3724 KiB
005.txt WA 2 ms 3764 KiB
006.txt WA 2 ms 3848 KiB
007.txt WA 2 ms 3660 KiB
008.txt WA 2 ms 3816 KiB
009.txt WA 3 ms 3660 KiB
010.txt WA 3 ms 3656 KiB
011.txt WA 2 ms 3820 KiB
012.txt WA 2 ms 3740 KiB
013.txt WA 3 ms 3700 KiB
014.txt WA 2 ms 3752 KiB
015.txt WA 2 ms 3632 KiB
016.txt WA 2 ms 3660 KiB
017.txt WA 2 ms 3816 KiB
018.txt WA 2 ms 3656 KiB
019.txt WA 3 ms 3820 KiB
020.txt WA 3 ms 3700 KiB
021.txt WA 2 ms 3692 KiB
022.txt WA 2 ms 3776 KiB
023.txt WA 2 ms 3776 KiB
024.txt WA 2 ms 3704 KiB
example0.txt AC 3 ms 3780 KiB