TopCoder SRM 480で大敗北

250点問題と500点問題そこそこの速度でサブミットしてよっしゃあって思ってたら2問ともチャレンジされてしかも成功された。
0点だった。レートがグレーになってしまった。ショックだ。

一応自分の誤答をはってみる。

250

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

class Cryptography {
public:
	long long encrypt(vector <int> numbers) {
		vector<int> v;
		long long m, n = 0;
		for(int i = 0; i < numbers.size(); i++){
			v = numbers;
			v[i]++;
			m = v[0];
			for(int j = 1; j < v.size(); j++)
				m *= v[j];
			if(m > n) n = m;
		}
		return n;
	}

	

};

多分long long、なのかなあ…
(追記)Practice RoomでSystem Testしたら普通にlong longが原因だった。ので上のソースで修正しておいた。

500

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

class InternetSecurity {
public:
	vector <string> determineWebsite(vector <string> address, vector <string> keyword, vector <string> dangerous, int threshold) {
		vector<string> res;
		for(int i = 0, ts = 0; i < keyword.size(); i++){
			ts = 0;
			vector<string> v;
			string s("");
			for(int j = 0; j < keyword[i].size(); j++){
				if(keyword[i][j] == ' '){
					if(!s.empty()){
						v.push_back(s); s = "";
					}
				}else{
					s += keyword[i][j];
				}
			}
			if(!s.empty()) v.push_back(s);
			for(int j = 0; j < v.size(); j++)
				for(int k = 0; k < dangerous.size(); k++)
					if(v[j] == dangerous[k]) ts++;
			if(ts >= threshold){
				res.push_back(address[i]);
				for(int j = 0, f = 1; j < v.size(); j++){
					f = 1;
					for(int k = 0; k < dangerous.size(); k++)
						if(v[j] == dangerous[k]) f = 0;
					if(f) dangerous.push_back(v[j]);
				}
			}


		}
		return res;
	}
};

string分割まわりとか、いくらでも考えられる点はあるけど…