Size: a a a

2020 June 08

DU

DeepInside Unix in pro.js
мейби, но тут тест не только для ноды, тут для всех языков. Возможно они просто null туда суют
источник

L

Lupusregina[beta] in pro.js
DeepInside Unix
мейби, но тут тест не только для ноды, тут для всех языков. Возможно они просто null туда суют
const fs = require('fs');

const INPUT_FILE = 'input-201.txt'
const OUTPUT_FILE = 'input-201.a.txt'

function parseFile(path, next) {
 const input = fs.readFileSync(path, "utf8")
 let i = 0, j = 0;
 for(j = i; j < input.length; j++) {
   if ( input[j] === "\r" || input[j] === "\n" ) {
     if ( i !== j )
       next( input.slice(i, j) )

     i = j + 1
   }
 }
 if ( i !== j )
   next( input.slice(i, j) )
}
class Uni {
 constructor() {
   const map = {}
   this.n = 0
   this.next = s => {
     s |= 0
     const c = map[s] = (map[s]|0) + 1
     if ( c <= 2 )
       this.n ^= +s
   }
 }
}

const u = new Uni()
parseFile(INPUT_FILE, u.next)

fs.writeFileSync(OUTPUT_FILE, u.n)
источник

S

Syntax Highlight Bot in pro.js
Lupusregina[beta]
const fs = require('fs');

const INPUT_FILE = 'input-201.txt'
const OUTPUT_FILE = 'input-201.a.txt'

function parseFile(path, next) {
 const input = fs.readFileSync(path, "utf8")
 let i = 0, j = 0;
 for(j = i; j < input.length; j++) {
   if ( input[j] === "\r" || input[j] === "\n" ) {
     if ( i !== j )
       next( input.slice(i, j) )

     i = j + 1
   }
 }
 if ( i !== j )
   next( input.slice(i, j) )
}
class Uni {
 constructor() {
   const map = {}
   this.n = 0
   this.next = s => {
     s |= 0
     const c = map[s] = (map[s]|0) + 1
     if ( c <= 2 )
       this.n ^= +s
   }
 }
}

const u = new Uni()
parseFile(INPUT_FILE, u.next)

fs.writeFileSync(OUTPUT_FILE, u.n)
источник

DU

DeepInside Unix in pro.js
Lupusregina[beta]
const fs = require('fs');

const INPUT_FILE = 'input-201.txt'
const OUTPUT_FILE = 'input-201.a.txt'

function parseFile(path, next) {
 const input = fs.readFileSync(path, "utf8")
 let i = 0, j = 0;
 for(j = i; j < input.length; j++) {
   if ( input[j] === "\r" || input[j] === "\n" ) {
     if ( i !== j )
       next( input.slice(i, j) )

     i = j + 1
   }
 }
 if ( i !== j )
   next( input.slice(i, j) )
}
class Uni {
 constructor() {
   const map = {}
   this.n = 0
   this.next = s => {
     s |= 0
     const c = map[s] = (map[s]|0) + 1
     if ( c <= 2 )
       this.n ^= +s
   }
 }
}

const u = new Uni()
parseFile(INPUT_FILE, u.next)

fs.writeFileSync(OUTPUT_FILE, u.n)
тоже самое
источник

L

Lupusregina[beta] in pro.js
DeepInside Unix
тоже самое
а покажи, какой код 3й тест проходил
источник

DU

DeepInside Unix in pro.js
никакой в том то и дело)
источник

L

Lupusregina[beta] in pro.js
DeepInside Unix
никакой в том то и дело)
const fs = require('fs');

const INPUT_FILE = 'input-201.txt'
const OUTPUT_FILE = 'input-201.a.txt'

function parseFile(path, next) {
 const input = fs.readFileSync(path, "utf8")
 let i = 0, j = 0;
 for(j = i; j < input.length; j++) {
   if ( input[j] === "\r" || input[j] === "\n" ) {
     if ( i !== j )
       next( input.slice(i, j) )

     i = j + 1
   }
 }
 if ( i !== j )
   next( input.slice(i, j) )
}
class Uni {
 constructor() {
   const map = {}
   this.n = 0
   this.next = s => {
     if ( !isFinite(s) )
       return
     
     s |= 0
     const c = map[s] = (map[s]|0) + 1
     if ( c <= 2 )
       this.n ^= +s
   }
 }
}

const u = new Uni()
parseFile(INPUT_FILE, u.next)

fs.writeFileSync(OUTPUT_FILE, u.n)
источник

DU

DeepInside Unix in pro.js
Тоже самое
На 3-тий раз он пишет wrong-answer. т.е код ему вернул число, но не то какое тесту хочется
Так можно бесконечно гадать
источник

DE

Denis Efremov in pro.js
DeepInside Unix
Тоже самое
На 3-тий раз он пишет wrong-answer. т.е код ему вернул число, но не то какое тесту хочется
Так можно бесконечно гадать
Нельзя
источник

L

Lupusregina[beta] in pro.js
DeepInside Unix
Тоже самое
На 3-тий раз он пишет wrong-answer. т.е код ему вернул число, но не то какое тесту хочется
Так можно бесконечно гадать
может там большие числа?
источник

L

Lupusregina[beta] in pro.js
DeepInside Unix
Тоже самое
На 3-тий раз он пишет wrong-answer. т.е код ему вернул число, но не то какое тесту хочется
Так можно бесконечно гадать
const fs = require('fs');

const INPUT_FILE = 'input-201.txt'
const OUTPUT_FILE = 'input-201.a.txt'

function parseFile(path, next) {
 const input = fs.readFileSync(path, "utf8")
 let i = 0, j = 0;
 for(j = i; j < input.length; j++) {
   if ( input[j] === "\r" || input[j] === "\n" ) {
     if ( i !== j )
       next( input.slice(i, j) )

     i = j + 1
   }
 }
 if ( i !== j )
   next( input.slice(i, j) )
}
class Uni {
 constructor() {
   const map = this.map = {}
   this.next = s => {
     map[s] = (map[s]|0) + 1
   }
 }
 
 get() {
   for(let i in this.map)
     if ( this.map[i] === 1 )
       return i

   return ""
 }
}

const u = new Uni()
parseFile(INPUT_FILE, u.next)

fs.writeFileSync(OUTPUT_FILE, u.get())
источник

DU

DeepInside Unix in pro.js
ЕБАТЬ
источник

DU

DeepInside Unix in pro.js
Да сука))
источник

DU

DeepInside Unix in pro.js
Тесты прошли
источник

DU

DeepInside Unix in pro.js
Я должен тебе пиво)
источник

L

Lupusregina[beta] in pro.js
DeepInside Unix
Тесты прошли
const fs = require('fs');

const INPUT_FILE = 'input-201.txt'
const OUTPUT_FILE = 'input-201.a.txt'

fs.writeFileSync(OUTPUT_FILE, [...fs
 .readFileSync(INPUT_FILE, "utf8")
 .split(/[\r\n]+/)
 .reduce((m, v) => m.set(v, (m.get(v)|0)+1), new Map)]
 .find(v => v[1] === 1)[0])
а так
источник

S

Syntax Highlight Bot in pro.js
Lupusregina[beta]
const fs = require('fs');

const INPUT_FILE = 'input-201.txt'
const OUTPUT_FILE = 'input-201.a.txt'

fs.writeFileSync(OUTPUT_FILE, [...fs
 .readFileSync(INPUT_FILE, "utf8")
 .split(/[\r\n]+/)
 .reduce((m, v) => m.set(v, (m.get(v)|0)+1), new Map)]
 .find(v => v[1] === 1)[0])
а так
источник

DU

DeepInside Unix in pro.js
Нихуя ты джедай...
источник

DU

DeepInside Unix in pro.js
Работает
источник

НА

Николай Алиферов... in pro.js
парень был рождён для этого)
источник