結果

問題 No.2965 Don't Stop the Game again
コンテスト
ユーザー 👑 kmjp
提出日時 2024-11-19 00:23:09
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,024 ms
コード長 1,448 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,173 ms
コンパイル使用メモリ 220,900 KB
実行使用メモリ 9,228 KB
最終ジャッジ日時 2026-07-06 04:33:30
合計ジャッジ時間 6,513 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/vector:67,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/functional:66,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:55,
                 from main.cpp:1:
In function '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const int*; _ForwardIterator = int*]',
    inlined from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _Sentinel, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = const int*; _Sentinel = const int*; _ForwardIterator = int*; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/stl_uninitialized.h:637:37,
    inlined from 'void std::vector<_Tp, _Alloc>::_M_range_initialize_n(_Iterator, _Sentinel, size_type) [with _Iterator = const int*; _Sentinel = const int*; _Tp = int; _Alloc = std::allocator<int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/stl_vector.h:1989:37,
    inlined from 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/stl_vector.h:712:23,
    inlined from 'void solve()' at main.cpp:31:18:
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/stl_uninitialized.h:273:31: warning: 'y' may be used uninitialized [-Wmaybe-uninitialized]
  273 |               __builtin_memcpy(std::__niter_base(__result),
      |               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  274 |                                std::__niter_base(__first),
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  275 |                                __n * sizeof(_ValT));
      |                                ~~~~~~~~~~~~~~~~~~~~
main.cpp: In function 'vo

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int M;
ll Q[55];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	vector<vector<int>> R;
	cin>>M;
	FOR(i,50) {
		cin>>Q[i];
		if(Q[i]==1) x=i;
		if(Q[i]!=1) y=i;
	}
	int sum=x;
	FOR(i,50) R.push_back({1,i+1});
	vector<int> C={y};
	FOR(i,50) if(i!=y&&i!=x) C.push_back(i);
	FOR(i,30) {
		R.push_back({4,C[i]+1,C[i]+1,C[i+1]+1});
	}
	int first=-1;
	FOR(i,30) if(M&(1<<i)) {
		if(first==-1) {
			first=C[i];
		}
		else {
			R.push_back({4,first+1,C[i]+1,first+1});
		}
	}
	
	FOR(i,50) if(i!=first&&i!=sum) R.push_back({4,first+1,first+1,i+1});
	
	cout<<R.size()<<endl;
	FORR(r,R) {
		FOR(i,r.size()-1) cout<<r[i]<<" ";
		cout<<r.back()<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0