Submission #601748


Source Code Expand

import std.stdio,
       std.string,
       std.range,
       std.algorithm;

import std.functional;
import std.range;
import std.traits;
import std.typecons; 
template any(alias pred = "a")
{
    bool any(Range)(Range range)
    if (isInputRange!Range && is(typeof(unaryFun!pred(range.front))))
    {
        return !find!pred(range).empty;
    }
}

template all(alias pred = "a")
{
    bool all(Range)(Range range)
    if (isInputRange!Range && is(typeof(unaryFun!pred(range.front))))
    {
        import std.functional : not;

        return find!(not!(unaryFun!pred))(range).empty;
    }
}

void main(){
  string[] cs = ["a", "t", "c", "o", "d", "e", "r", "@"];
 (zip(readln.chomp.split(""), readln.chomp.split("")).all!(t => 
      (t[0] == "@" && cs.any!(e => e == t[1]) ) || t[1] == "@" &&  cs.any!(e => e == t[0]) 
      || t[0] == t[1]) ? "You can win":"You will lose" )
    .writeln;
}

Submission Info

Submission Time
Task B - AtCoderトランプ
User alphaKAI
Language D (DMD 2.060)
Score 0
Code Size 933 Byte
Status CE

Compile Error

Error: function Main.main.not!(__lambda2).not!(Tuple!(string,string)).not is a nested function and cannot be accessed from std.algorithm.find!(not,Zip!(string[],string[])).find