Code Submission Evaluation System Login

HIIT Open 2018

Start:2018-05-26 11:00:00
End:2018-05-26 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2018 - Results
History
2018-05-26 15:58:46
2018-05-26 15:57:38
2018-05-26 15:56:55
2018-05-26 15:56:39
2018-05-26 15:56:15
2018-05-26 14:29:26
2018-05-26 14:20:54
2018-05-26 14:01:31
Task:Euclidean Geometry
Sender:Ukkonen Fan Club
Submission time:2018-05-26 15:58:46
Language:C++
Status:READY
Result:WRONG ANSWER

Test results

testverdicttime (s)
#1ACCEPTED0.03 / 1.00details
#2WRONG ANSWER0.03 / 1.00details
#3ACCEPTED0.04 / 1.00details
#4ACCEPTED0.03 / 1.00details
#5ACCEPTED0.04 / 1.00details
#6WRONG ANSWER0.04 / 1.00details
#7ACCEPTED0.03 / 1.00details
#8ACCEPTED0.03 / 1.00details

Code

#include <bits/stdc++.h>
#define x real()
#define Y imag()
#define F first
#define S second
const double SIDE_THRESHOLD = 5;

int D2=350;
double MA=20.0   /180.0*3.14159265358979;


using namespace std;
char t[111][111];
typedef long long ll;
typedef complex<double> co;


long long d2(pair<int, int> a, pair<int, int> b){
    return (a.F-b.F)*(a.F-b.F)+(a.S-b.S)*(a.S-b.S);
}


double dotP(pair<int, int> a, pair<int, int> b){
    return a.F*b.F+a.S*b.S;
}


double angle(pair<int, int> a, pair<int, int> b){
    return acos(dotP(a,b)/sqrt(dotP(a,a)*dotP(b,b)));
}

bool ok(pair<int, int> a, pair<int, int> b, pair<int, int> c){
    pair<int, int> v1={b.F-a.F, b.S-a.S};
    pair<int, int> v2={c.F-b.F, c.S-b.S};
    return abs(angle(v1, v2))>MA;
}

void solve(){
    int n=100;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            cin>>t[i][j];
        }
    }
    vector<pair<int, int> > dh;
    vector<pair<int, int> > uh;
    for (int i=0;i<n;++i){
        bool f=0;
        int l=0;
        for (int j=0;j<n;++j){
            if (t[i][j]=='1'){
                if (!f) uh.push_back({i,j});
                f=1;
                l=j;
            }
        }
        if (f){
            dh.push_back({i,l});
        }
    }
    vector<pair<int, int> > dsh;
    vector<pair<int, int> > ush;
    dsh.push_back(dh[0]);
    ush.push_back(uh[0]);
    for (auto v:dh){
        if (dsh.size()==1){
            if (d2(v, dsh.back())<D2/4) continue;
            dsh.push_back(v);
        }else{
            if (!ok(dsh[dsh.size()-2], dsh[dsh.size()-1], v)) dsh.pop_back();
            if (d2(v, dsh.back())<D2) continue;
            dsh.push_back(v);
        }
    }
    for (auto v:uh){
        if (ush.size()==1){
            if (d2(v, ush.back())<D2/4) continue;
            ush.push_back(v);
        }else{
            if (!ok(ush[ush.size()-2], ush[ush.size()-1], v)) ush.pop_back();
            if (d2(v, ush.back())<D2) continue;
            ush.push_back(v);
        }
    }
    int minus=0;
    if (dsh[0]!=ush[0]){
        if (!ok(dsh[0], ush[0], ush[1]) || !ok(ush[0], dsh[0], dsh[1]) || d2(ush[0], dsh[0])<D2/4) ++minus;
    }
    if (dsh.back()!=ush.back()){
        if (!ok(dsh.back(), ush.back(), ush[ush.size()-2]) || !ok(ush.back(), dsh.back(), dsh[dsh.size()-2])  || d2(ush.back(), dsh.back())<D2/4) ++minus;
    }
    set<pair<int, int> > k;
    for (auto v:dsh) k.insert(v);
    for (auto v:ush) k.insert(v);
//     for (auto n:k) cout << n.F << ", " << n.S << endl;
    cout << k.size()-minus << "\n";
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int t;
    cin >> t;
    for (int i=0;i<t;++i)solve();
}

Test details

Test 1

Verdict: ACCEPTED

input
100
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
view   save

correct output
3
3
3
3
4
4
4
4
3
4
4
3
3
4
4
4
3
4
3
4
...
view   save

user output
3
3
3
3
4
4
4
4
3
4
4
3
3
4
4
4
3
4
3
4
...
view   save

Test 2

Verdict: WRONG ANSWER

input
100
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
view   save

correct output
3
4
4
4
3
3
3
4
3
4
4
4
3
3
3
4
4
4
3
4
...
view   save

user output
3
4
4
4
3
3
3
4
3
4
4
4
3
3
3
4
4
4
3
4
...
view   save

Test 3

Verdict: ACCEPTED

input
100
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
view   save

correct output
3
3
3
3
4
3
3
4
4
3
4
4
3
4
3
3
3
4
4
3
...
view   save

user output
3
3
3
3
4
3
3
4
4
3
4
4
3
4
3
3
3
4
4
3
...
view   save

Test 4

Verdict: ACCEPTED

input
100
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
view   save

correct output
3
3
3
4
3
4
4
4
3
3
3
4
4
4
4
3
3
3
4
3
...
view   save

user output
3
3
3
4
3
4
4
4
3
3
3
4
4
4
4
3
3
3
4
3
...
view   save

Test 5

Verdict: ACCEPTED

input
100
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
view   save

correct output
3
4
3
3
4
3
3
4
3
3
4
4
4
3
3
4
4
3
4
4
...
view   save

user output
3
4
3
3
4
3
3
4
3
3
4
4
4
3
3
4
4
3
4
4
...
view   save

Test 6

Verdict: WRONG ANSWER

input
100
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
view   save

correct output
4
3
4
4
4
3
4
4
3
3
4
3
3
4
4
3
4
3
4
3
...
view   save

user output
4
3
4
4
4
3
4
4
3
3
4
3
3
4
4
3
4
3
4
3
...
view   save

Test 7

Verdict: ACCEPTED

input
100
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000001000...
000000000000000000000000001110...
000000000000000000000000001111...
view   save

correct output
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
4
4
3
...
view   save

user output
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
4
4
3
...
view   save

Test 8

Verdict: ACCEPTED

input
100
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
000000000000000000000000000000...
view   save

correct output
3
3
3
3
3
4
3
4
4
4
3
3
3
4
3
3
4
3
3
3
...
view   save

user output
3
3
3
3
3
4
3
4
4
4
3
3
3
4
3
3
4
3
3
3
...
view   save