ログインしてください。
提出 #1622792
ソースコード 拡げる
#define _USE_MATH_DEFINES
#include <sstream> //string stream its useful!
#include<string>
#include<iostream>
#include<utility> //pair
#include <vector> // vector
#include <algorithm> // swap,sort,binary_search
#include <functional> // std::greater
#include <map> //map
#include<set> //set
#include<queue> //queue
#include<list> //list
#include<cmath>
#include<numeric>
#include<cassert>
#include <iomanip> //cout<<setprecision
#include <regex>
#include <ctype.h> //toupper case
#include <tuple>
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
const ll W = 1000000007;
const int alphacount = 26;
using namespace std;
void omajinai() {
cin.tie(0);
ios::sync_with_stdio(false);
cout<<setprecision(15);
}
class Main{
public:
ll H,W,D;
Main(){
cin>>H>>W>>D;
}
void run(){
char c[4] = {'R','Y','G','B'};
int dx[4] = {-1,-1,1,1};
int dy[4] = {-1,1,-1,1};
vector<vector<int> > ret(H,vector<int>(W,-1));
queue<pair<int ,int> > q;
REP(i,D){
q.push(make_pair(0,i));
}
while(!q.empty()){
const pair<int,int> p = q.front();
vector<bool> b(4,false);
q.pop();
REP(i,4){
REP(j,D+1){
int xx = p.first + j * dx[i];
int yy = p.second + (D-j) * dy[i];
if(xx<0 || yy < 0 ||xx>=H || yy >= W) continue;
if(ret[xx][yy] < 0){
if(ret[xx][yy] == -1){ q.push(make_pair(xx,yy)); ret[xx][yy]--;}
continue;
}
b[ret[xx][yy]] = true;
}
}
REP(i,4){
if(!b[i]){
ret[p.first][p.second] = i;
break;
}
}
assert(ret[p.first][p.second]!=-1);
}
REP(i,H){
FOR(j,W) cout<<c[ret[i][j]];
cout<<endl;
}
}
};
#ifndef gtest
int main(){
omajinai();
Main().run();
return 0;
}
#endif
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Four Coloring |
| ユーザ | tamtam484 |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 0 |
| コード長 | 2315 Byte |
| 結果 | CE |
コンパイルエラー
./Main.cpp:81:20: error: macro "FOR" requires 3 arguments, but only 2 given
FOR(j,W) cout<<c[ret[i][j]];
^
./Main.cpp: In member function ‘void Main::run()’:
./Main.cpp:81:13: error: ‘FOR’ was not declared in this scope
FOR(j,W) cout<<c[ret[i][j]];
^