Submission #2864375
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main(){ int N,M; //入力 cin>>N; vector<string> vecBlue(N); for (int i=0; i<N; i++){ cin >> vecBlue.at(i); } cin>>M; vector<string> vecRed(M); for (int i=0; i<M; i++){ cin >> vecRed.at(i); } vector<string> vecName(N+M);//検索済みを入れる配列 int NameNum=0; char F; int maxPoint=0; //処理 //検索済みとすべて比較して、かぶったらやらない //vecNameに存在する加点文字列がかぶりなしで入り、 //NameNumにその種類の数が入る for (int i=0;i<N;i++){ F='?'; for (int j=0;j<NameNum;j++){ if( vecBlue.at(i)==vecName.at(j) ){//既出ならスルー F='F'; } } if(F!='F'){//加点文字列で新しいものが見つかれば、 vecName.at(NameNum)=vecBlue.at(i); NameNum++; //その文字列が何点か調べる int point=0; for(int k=0;k<N;k++){//加点と比較 if( vecBlue.at(i)==vecBlue.at(k) ){ point++; } } for(int k=0;k<M;k++){//減点と比較 if( vecBlue.at(i)==vecRed.at(k) ){ point--; } } if(maxPoint<point){maxPoint=point;} //cout<<point<<"点"<<vecBlue.at(i)<<endl;//各点確認できる } } //出力 if(maxPoint<0){ cout<<"0"<<endl; } else{ cout<<maxPoint<<endl; } for (int i=0; i<N; i++){ //cout << vecBlue.at(i) << endl; } for (int i=0; i<M; i++){ //cout << vecRed.at(i) << endl; } }
Submission Info
Submission Time | |
---|---|
Task | B - Two Colors Card Game |
User | gizyo |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1897 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_0, example_1, example_2, example_3 |
All | example_0, example_1, example_2, example_3, rand_0, rand_1, rand_2, rand_3, rand_4, rand_5, rand_6 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_0 | AC | 1 ms | 256 KB |
example_1 | AC | 1 ms | 256 KB |
example_2 | AC | 1 ms | 256 KB |
example_3 | AC | 1 ms | 256 KB |
rand_0 | AC | 1 ms | 256 KB |
rand_1 | AC | 1 ms | 256 KB |
rand_2 | AC | 1 ms | 256 KB |
rand_3 | AC | 1 ms | 256 KB |
rand_4 | AC | 1 ms | 256 KB |
rand_5 | AC | 1 ms | 256 KB |
rand_6 | AC | 1 ms | 256 KB |