QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#135886#2302. KnitpickingmojospyWA 1ms3516kbC++14645b2023-08-06 14:40:032023-08-06 14:40:06

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-06 14:40:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3516kb
  • [2023-08-06 14:40:03]
  • 提交

answer

#include<iostream>
#include<unordered_map>
using namespace std;
struct sock{
	string op;
	int cnt;
};
unordered_map<string,int> m;
int main(){
	int res=0;
	int n;
	cin>>n;
	string type,op;
	int cnt;
	bool flag=false;
	for(int i=0;i<n;++i){
		cin>>type>>op>>cnt;
		if(op=="any"&&cnt>=2) flag=true;
		if(m.find(type)!=m.end()){
			flag=true;
			if(op!="any"&&m[type]<cnt) m[type]=cnt;
		}
		else{
			if(op=="any") m[type]=1;
			else m[type]=cnt; 
		}
	}
	if(flag){
		for(unordered_map<string,int>::iterator it=m.begin();it!=m.end();++it) res+=it->second;
		cout<<res+1; 
	}
	else cout<<"imopssible";
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3516kb

input:

1
a right 1

output:

imopssible

result:

wrong answer 1st lines differ - expected: 'impossible', found: 'imopssible'