QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#736365#5130. Failing Flagshipnicksms#AC ✓0ms4052kbC++171.2kb2024-11-12 10:28:512024-11-12 10:28:51

Judging History

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

  • [2024-11-12 10:28:51]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:4052kb
  • [2024-11-12 10:28:51]
  • 提交

answer

/**
 *      Author:  Nicholas Winschel
 *      Created: 11.11.2024 21:18:48
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using db=long double;
template<class T> using V=vector<T>;
using vi = V<int>;
using vl = V<ll>;
using pi = pair<int,int>;
#define f first
#define s second
#define sz(x) (int)((x).size())
#define each(a,b) for (auto &a : b)

db eval(string &s) {
  if (s.find('S') != s.npos) {
    for (char &c : s) if (c == 'S') {
      c = 'N';
    }
    return 360-eval(s);
  }
  if (s.find('W') != s.npos) {
    for (char &c : s) if (c == 'W') {
      c = 'E';
    }
    return 180-eval(s);
  }
  if (sz(s) == 1) {
    if (s[0] == 'N') return 90;
    if (s[0] == 'E') return 0;
  }
  db l = 90, r = 0;
  for (int i = s.size()-3; i >= 0; --i) {
    if (s[i] == 'N') r = (l+r)/2;
    else if (s[i] == 'E') l = (l+r)/2;
  }

  return (l + r)/2;
}

int main() {
  cin.tie(0)->sync_with_stdio(0); // initialize fast I/O

  string x, y; cin >> x >> y;
  string tmp = "NW";
  db ans = abs(eval(x)-eval(y));
  if (ans > 360-ans) ans = 360-ans;
  cout << fixed << setprecision(15) << ans << '\n';
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3824kb

input:

N S

output:

180.000000000000000

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

NNE SSSE

output:

146.250000000000000

result:

ok found '146.2500000', expected '146.2500000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

ENE NW

output:

112.500000000000000

result:

ok found '112.5000000', expected '112.5000000', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

SW SE

output:

90.000000000000000

result:

ok found '90.0000000', expected '90.0000000', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

NENE SESSE

output:

95.625000000000000

result:

ok found '95.6250000', expected '95.6250000', error '0.0000000'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

NWWNNWNWNW E

output:

148.535156250000000

result:

ok found '148.5351562', expected '148.5351562', error '0.0000000'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

SWWWSWSSSSW NNNNNNNNNNNW

output:

171.782226562500000

result:

ok found '171.7822266', expected '171.7822266', error '0.0000000'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

N N

output:

0.000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

S N

output:

180.000000000000000

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

NW SE

output:

180.000000000000000

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

SE SESE

output:

11.250000000000000

result:

ok found '11.2500000', expected '11.2500000', error '0.0000000'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

SE SSESE

output:

5.625000000000000

result:

ok found '5.6250000', expected '5.6250000', error '0.0000000'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

EEENE ENENE

output:

22.500000000000000

result:

ok found '22.5000000', expected '22.5000000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

NW NNWWNNNNWNWNNNNNNNNNWNNNWNWNWWNWNWNWNWNWWNNNNNNNNNNNWNWNWWWNWNNWNWWWWWWNWWWNNNWNNWNNNNNNNWWWWWNNNNNNWNWWWNNWNWNWNNNNNNWWNWWWNNNNWNNWWNNNNWWWWNWNNWWWNNWWWNNNWNNWWWWWWWNNWWWWWNWNNNNWWWNWWNNNWNWNWNNNNWNNWWWNWNNNNWWWWNNNWWNWNWNWNNNWNWNNWNWNWNNNNNNWNNNWWNNNNNWNWWWNWWNWNWWWWWNWNNWWWNNWNWNNWNWWWWWWWNNWW...

output:

3.147502463404251

result:

ok found '3.1475025', expected '3.1475025', error '0.0000000'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

WNWWNWNWNNNWNWWWWNNNWWNWNWWNNWNNWWWNWNNWWWWWWWWWNWWNWNNWWNWNNNWWNNNNNNNWWWWNWWNWWNWWWNNWNWNWNNNNNNWNWWNNNWNWWWNNNNWWNWNWWWWWNWWWNWWWWWNNWNNWWNWWWWNNWNWNNWNNNWWNNNWWWWWNNWWWWWWNNWWNWNNWWWNNNNWNNNNNNWNNNWNNWNWWWWWWNNNNNWNWNNNWWNNNWNNNNNWWNWNWNWNNWNNNNNWWWNNNNNNWNNWNNNNWWWWNNNWNWWWWWNWWNWWWNNNWWWWWNWWN...

output:

82.266154781057955

result:

ok found '82.2661548', expected '82.2661548', error '0.0000000'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

NNNENNNNEENNEEENEENNNNENNNENEENEENNNNENENEENNNEENE WNNWWNWWWNNWNNNNWWNWNNWNNNWNNWWNNWWWWWNWNNWWNNWNNWNNNWNWWNWWNNNWNWNNWWWWWWWWWWWWNWWNNWWWNNNNWWWNNWNWNNNNWWNNNWNWNWNNNWWNNWWWNWWNNWNWNNNWNWWNWNNNNNNNNNWWWNWWNWWWNWNWNWNNNWNNNWNNWNWNWWWNNWWWWWWNWNNNNNWNNWWWWNNNNNNWWWNWNWNWNWNWNNWNWWWNNNNWNNWWWNWNWNWWW...

output:

82.779500341150875

result:

ok found '82.7795003', expected '82.7795003', error '0.0000000'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

WNNWNWWWWNNWWWWNWNNWWNNWWNWNNWNWWWWWNWNWNNWWNNWWNNNNWNNNNWWNWNNNWNWNWNWWWNNWNWWNNWWWNWNWWWNWWNNWWNWNWNNWNWWWWNNWNWNNNNWWNWWWNWNWNWNWNNNNWNWWNNNNNNNWNNWWNNWNWWNNWWNNWWWWWWWNNWNWNWWWNNWWWNWNWWNWNNWWNWNNWNNNNNNNNWWWWNWNNNNWNNWWNNNNWNWWNWWNNWNWNNWNNNNWWNWWNWNNWWWWWNNWNNNNWWWWNNWWWNWWNWWNNWNWNNWNNNNWNWWN...

output:

124.593236661150894

result:

ok found '124.5932367', expected '124.5932367', error '0.0000000'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

SSSEEEEEESEEEESSESEEEEEEEEESSEEESSESSESSSESSSESEEEEESSSSEESSSSSEESSSESESEEESEESEEEEEEESSSSESSESSESEESEESSESEESESSSSEESSESSESSEESEEEESSESEEEEEEEESEEEESEESEESSESEESEEESEESESEESSEESESESESSESESESSEESSEEESEESESESEEESESSSESEESESSESEESSSESESSESEESSEEEESSSSSSESSEESSSSEESEESESSESSSEESSEEESSSESEEESSSEEEEESEES...

output:

132.995310618995228

result:

ok found '132.9953106', expected '132.9953106', error '0.0000000'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

WWNWNNNWNWNNWNNNNNWNNWNWNWNWWWWWNWNWNNWWNWWWWNNNWNWWWWWWWWWWWWNNNNNNNWWWWNNNWNWNWWWNNWWNNNNNWWWWWNWWNWWNWNWNNNWNWWNNNNNNWNNNWNNWWNWWWWNNNNNNNWNNWWWWWNNWWWNWWWWWWWNWWNNWWWNNNNNNWNNWNNNNNWNWNNNNWWNNNNNWWNNNNWWNWNNWNWNNNWWWWWWWNWNNNNNWNWWNWWWWWNNNNWNNNNNWWWWWWWWWNWWNWNWNNNWNNWWNNNWWWNWWNNWWWNNNNWWWNNNW...

output:

153.445052118082391

result:

ok found '153.4450521', expected '153.4450521', error '0.0000000'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

N NNNNNNNNNW

output:

0.175781250000000

result:

ok found '0.1757812', expected '0.1757812', error '0.0000000'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNE

output:

0.000000000040927

result:

ok found '0.0000000', expected '0.0000000', error '0.0000000'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

S SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSW

output:

0.000000000000080

result:

ok found '0.0000000', expected '0.0000000', error '0.0000000'

Test #23:

score: 0
Accepted
time: 0ms
memory: 4052kb

input:

S SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSE

output:

0.000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #24:

score: 0
Accepted
time: 0ms
memory: 4036kb

input:

N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...

output:

0.000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

NE EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...

output:

0.000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

E W

output:

180.000000000000000

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

W E

output:

180.000000000000000

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

EEEEEEEEEEEEEEEEEEEENE W

output:

179.999957084655762

result:

ok found '179.9999571', expected '179.9999571', error '0.0000000'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

EEEEEEEEEEEEEEEEEEEESE W

output:

179.999957084655762

result:

ok found '179.9999571', expected '179.9999571', error '0.0000000'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

EEEEEEEEEEEEEEEEEEEEESE W

output:

179.999978542327881

result:

ok found '179.9999785', expected '179.9999785', error '0.0000000'

Test #31:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEESE W

output:

179.999999958090484

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #32:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSWSW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWSSW

output:

0.000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #33:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

SSSSSSSSSSSSSSSSSSSSWSW WWWWWWWWWWWWWWWWWWWWSSW

output:

0.000042915344238

result:

ok found '0.0000429', expected '0.0000429', error '0.0000000'

Test #34:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

SSSSSSSSSSSSSWWWSSSWSWSWSSSSSWWWWWWSWSWSWSSSWWSSW SSSSSSSSSSSSSWWWSSSWSWSWSSSSSWWWWWWSWSWSWSSSWWSSW

output:

0.000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'