nikeeshi のコーディング記

コーディングの成果をはっつけるとこ。このブログにあるソースコードはNYSL Version 0.9982に従い公開します(2014/06/18)。

SRM 580 Div2

250と500は通っても1000は通らない。 250と500のコードはっつけます。

//250.cpp
#include <vector>
#include <string>
using namespace std;
class ShoutterDiv2{
public:
    int count(vector <int> s, vector <int> t)
    {
        int n=s.size();
        int ret=0;
        for(int i=0;i<n;i++)
            for(int j=i+1;j<n;j++)
            {
                if(t[i]<s[j]||t[j]<s[i]);
                else ret++;
            }
        return ret;
    }

};

#include <vector>
#include <string>
using namespace std;
class EelAndRabbit{
public:
    int getmax(vector <int> l, vector <int> t)
    {
        int curmax=0;
        int n=l.size();
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                int count=0;
                for(int k=0;k<n;k++){
                    if((t[k]<=t[i]&&t[i]<=t[k]+l[k])
                        ||(t[k]<=t[j]&&t[j]<=t[k]+l[k]))
                        count++;
                }
                if(curmax<count)curmax=count;
            }
        }
        return curmax;
    }
};

1000はシステムで落とされて悲しいので載せません。