結果
| 問題 |
No.1468 Colourful Pastel
|
| ユーザー |
Nachia
|
| 提出日時 | 2021-04-04 14:43:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 1,000 ms |
| コード長 | 856 bytes |
| コンパイル時間 | 2,640 ms |
| コンパイル使用メモリ | 192,184 KB |
| 最終ジャッジ日時 | 2025-01-20 11:11:13 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:27: warning: format not a string literal and no format arguments [-Wformat-security]
28 | rep(t,7) if(C[t]) printf(Colors2[t]);
| ~~~~~~^~~~~~~~~~~~
main.cpp: In function ‘int getColorIdx(char)’:
main.cpp:19:62: warning: control reaches end of non-void function [-Wreturn-type]
19 | int getColorIdx(char c){ rep(t,7) if(Colors[t]==c) return t; }
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
#define READ_A_CHAR getchar_unlocked
int readInt(){
int res=0;
char c;
while((c=READ_A_CHAR())!='\n') res=res*10+(c-'0');
return res;
}
void readUntil(char c){ while(READ_A_CHAR()!=c); }
const char Colors[] = "ROYGCBV";
const char* Colors2[] = {"Red\n","Orange\n","Yellow\n","Green\n","Cyan\n","Blue\n","Violet\n"};
int getColorIdx(char c){ rep(t,7) if(Colors[t]==c) return t; }
int main(){
int N=readInt();
int C[7]={};
rep(i,N-1) C[getColorIdx(READ_A_CHAR())]++, readUntil(' ');
C[getColorIdx(READ_A_CHAR())]++, readUntil('\n');
rep(i,N-2) C[getColorIdx(READ_A_CHAR())]--, readUntil(' ');
C[getColorIdx(READ_A_CHAR())]--, readUntil('\n');
rep(t,7) if(C[t]) printf(Colors2[t]);
return 0;
}
Nachia