結果
| 問題 |
No.5022 XOR Printer
|
| コンテスト | |
| ユーザー |
tnktsyk
|
| 提出日時 | 2025-07-26 14:01:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,074 bytes |
| コンパイル時間 | 4,058 ms |
| コンパイル使用メモリ | 257,876 KB |
| 実行使用メモリ | 7,720 KB |
| スコア | 2,595,744,694 |
| 最終ジャッジ日時 | 2025-07-26 14:01:11 |
| 合計ジャッジ時間 | 6,632 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
#define rep(i,n) for(auto i=0;i<n;i++)
#define repd(i,n) for(auto i=n-1;i>=0;i--)
#define rep1(i,n) for(auto i=1;i<=n;i++)
#define rep_lt(i,j,n) for(auto i=j;i<n;i++) //半開区間
void printd(ld x){cout<<fixed<<setprecision(16)<<x<<endl;}
void printd2(ld x,ld y){
cout<<fixed<<setprecision(16)<<x<<' '<<y<<endl;
}
template<typename Vec>
void vcout(const Vec& vec){
for(auto& v:vec) cout<<v<<' ';
cout<<'\n';
}
template<typename Vec>
void vvcout(const Vec& vec){
for(auto& v:vec){
for(auto& k:v) cout<<k;
cout<<'\n';
}
}
template<typename T,typename U>
void chmax(T& a,const U& b){
if(a<b) a=b;
}
template<typename T,typename U>
void chmin(T& a,const U& b) {
if(a>b) a=b;
}
struct FastIO{
FastIO(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
} fastio;
void YN(bool state){cout<<(state?"Yes\n":"No\n");}
void CY(bool state){if(state)cout<<"Yes"<<endl,exit(0);}
void CN(bool state){if(state)cout<<"No"<<endl,exit(0);}
void Cm1(bool state){if(state)cout<<-1<<endl,exit(0);}
const ll INF=4e18;
#define all(p) p.begin(),p.end()
#define rall(p) p.rbegin(),p.rend()
#define fi first
#define se second
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353;
//using mint=modint1000000007;
using T=tuple<ll,ll,ll>;
using P=pair<ll,ll>;
//考察
int main(){
ll n,t;
cin>>n>>t;
vector a(n,vector<ll>(n));
rep(i,n)rep(j,n) cin>>a[i][j];
ll s=0;
ll ni=0,nj=0;
vector<ll> ans;
//マス(i,j)に移動
auto go=[&](ll i,ll j){
while(ni<i) ans.push_back('D'),ni++;
while(ni>i) ans.push_back('U'),ni--;
while(nj<j) ans.push_back('R'),nj++;
while(nj>j) ans.push_back('L'),nj--;
};
auto write=[&](ll i,ll j){
go(i,j);
ans.push_back('W');
a[i][j]^=s;
};
auto copy=[&](ll i,ll j){
go(i,j);
ans.push_back('C');
s^=a[i][j];
};
rep(i,n)rep(j,n) if(s<s^a[i][j]) copy(i,j);
repd(i,n)repd(j,n) if(a[i][j]<a[i][j]^s) write(i,j);
for(char p:ans) cout<<p<<'\n';
return 0;
}
tnktsyk