Submission #49925055
Source Code Expand
Copy
#include<bits/stdc++.h>#pragma GCC optimize(3,"Ofast","inline")using namespace std;#define int long longconst int mod=998244353ll;char g[110][110];int dir[4][2]={-1,0,0,1,1,0,0,-1};void solve(){int n,m,cnt;cin>>n>>m>>cnt;for(int i=0;i<n;i++)for(int j=0;j<m;j++)g[i][j]='.';int pos=0,nowx=0,nowy=0;while(cnt--){if(g[nowx][nowy]=='.'){g[nowx][nowy]='#';pos=(pos+1)%4;}else{g[nowx][nowy]='.';pos=(pos-1+4)%4;}nowx+=dir[pos][0],nowy+=dir[pos][1];nowx=(nowx+n)%n;
#include<bits/stdc++.h> #pragma GCC optimize(3,"Ofast","inline") using namespace std; #define int long long const int mod=998244353ll; char g[110][110]; int dir[4][2]={-1,0,0,1,1,0,0,-1}; void solve(){ int n,m,cnt;cin>>n>>m>>cnt; for(int i=0;i<n;i++)for(int j=0;j<m;j++)g[i][j]='.'; int pos=0,nowx=0,nowy=0; while(cnt--){ if(g[nowx][nowy]=='.'){ g[nowx][nowy]='#'; pos=(pos+1)%4; }else{ g[nowx][nowy]='.'; pos=(pos-1+4)%4; } nowx+=dir[pos][0],nowy+=dir[pos][1]; nowx=(nowx+n)%n; nowy=(nowy+m)%m; } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cout<<g[i][j]; }cout<<'\n'; } } signed main(){ ios::sync_with_stdio(0);cin.tie(0),cout.tie(0); // int t;cin>>t;while(t--) solve(); }
Submission Info
Submission Time | |
---|---|
Task | B - Langton's Takahashi |
User | chronicle12345 |
Language | C++ 20 (gcc 12.2) |
Score | 250 |
Code Size | 875 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3592 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 250 / 250 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample00.txt, sample01.txt, sample02.txt |
All | sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample00.txt | AC | 1 ms | 3384 KB |
sample01.txt | AC | 1 ms | 3452 KB |
sample02.txt | AC | 1 ms | 3376 KB |
testcase00.txt | AC | 1 ms | 3396 KB |
testcase01.txt | AC | 1 ms | 3456 KB |
testcase02.txt | AC | 1 ms | 3400 KB |
testcase03.txt | AC | 1 ms | 3404 KB |
testcase04.txt | AC | 1 ms | 3384 KB |
testcase05.txt | AC | 1 ms | 3592 KB |
testcase06.txt | AC | 1 ms | 3460 KB |
testcase07.txt | AC | 1 ms | 3444 KB |
testcase08.txt | AC | 1 ms | 3392 KB |
testcase09.txt | AC | 1 ms | 3464 KB |
testcase10.txt | AC | 1 ms | 3328 KB |
testcase11.txt | AC | 1 ms | 3444 KB |