結果

問題 No.1468 Colourful Pastel
ユーザー 👑 Nachia
提出日時 2021-04-04 14:54:53
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 8 ms / 1,000 ms
コード長 716 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 178 ms
コンパイル使用メモリ 39,616 KB
最終ジャッジ日時 2026-02-22 07:05:07
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#define rep(i,n) for(int i=0; i<(n); i++)

#define READ_A_CHAR getchar_unlocked


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=0;
  char c;
  while((c=READ_A_CHAR())!='\n') N=N*10+(c-'0');
  int C[7]={};
  rep(i,N-1){
    ++C[getColorIdx(READ_A_CHAR())];
    while(READ_A_CHAR()!=' ');
  }
  ++C[getColorIdx(READ_A_CHAR())];
  while(READ_A_CHAR()!='\n');
  rep(i,N-2){
    --C[getColorIdx(READ_A_CHAR())];
    while(READ_A_CHAR()!=' ');
  }
  --C[getColorIdx(READ_A_CHAR())];
  rep(t,7) if(C[t]) printf(Colors2[t]);
  return 0;
}
0