### Amoo_Safar's blog

By Amoo_Safar, history, 2 years ago,

hi everybody

I think in virtuals of contests that had pretests there should be pretests too!

because if we had some little bug but our code passed the pretest but failed system test after virtual contest it would be more similar to the result that we would get if we participate in original contest.

sorry for my bad english .

• +122

 » 2 years ago, # |   0 Yes, it is a good idea. Cheers.
 » 2 years ago, # |   +44 IMHO, Virtual contests are more about practice rather than real competition. For practicing it doesn't really matter when will you discover a bug in your solution — after a few seconds or a few hours. Also you almost never can be sure when your solution will fail on pretests rather than on system test, so you may safely consider failing on any test out of samples as a system test failure.But even if some people (like me) see no point in this feature implementing this as an option for virtual contests will definitely make no harm for anyone, and if some people need it why not?
•  » » 2 years ago, # ^ |   +47 Maybe the system can tell you if you failed at a pretest or a system test. So that if you fail to a system test you can just choose to ignore that and pretend you actually fail to system tests :Dd
 » 2 years ago, # | ← Rev. 2 →   +14 Getting a wrong answer after a contest is nerve racking! I prefer not to have that in virtuals.I think the only reason for having pretests in the actual contest is so that the servers wouldn't overload when many participants submit their codes at once and it doesn't take too long to test the codes. Since this is not a problem in a virtual participation, it's unnecessary to have pretests.
 » 2 years ago, # |   +19 That's a valid concern. I always wondered why is it like that. Having it tested on pretests only would definitely emulate real contest better and I would prefer that.
•  » » 2 years ago, # ^ |   0 Probably because it's easier to implement using the current checking mechanism.
 » 2 years ago, # |   +4 Nice idea, and it'd be perfect if we could choose in the beginning if we want it to be CF-style or ACM-style. Btw, in virtual contests nobody can hack your fixed srand seed :/
 » 2 years ago, # |   +30 I think it is good idea to make virtuals more similar to real contests, but in somebody's opinion virtual is for practice and it shouldn't fail after virtual.i think it should be something optimal in virtual so everybody choose what he want.and another good option is to select style of competition too! (ACM-style or CF-style [for contests that were CF-style]).so with this features virtuals becomes more ideal for everybody !!!!
•  » » 12 months ago, # ^ | ← Rev. 2 →   0 yeah but in that model how standings should be??
 » 12 months ago, # |   +14 This and this: https://codeforces.com/blog/entry/65806 are blog posts with >100 upvotes about the same issue.It's a shame that there's no response CF administration.
 » 12 months ago, # |   +22 While Codeforces doesn't support this natively, it's possible to use a userscript to achieve the same effect.I wrote a user script below. Currently it only modifies the "my submission" page. Code// ==UserScript== // @name Show only pretest result when participating in virtual contest in Codeforces // @version 0.0 // @description Show only pretest result when participating in virtual contest in Codeforces // @match *://codeforces.com/* // @grant none // @run-at document-start // ==/UserScript== (function(){ let searchParams=new URL(location).searchParams // always_show, reset_button let cache={} // problemId -> result let cacheSubmissions={} // submissionId -> item let participantId // assume participantId is fixed let csrf_token unsafeWindow.cache=cache unsafeWindow.cacheSubmissions=cacheSubmissions function getData(problemId,callback){ if(cache[problemId]!==undefined) callback(cache[problemId]) else{ if(csrf_token===undefined){ let elements=document.getElementsByName('X-Csrf-Token') if(elements.length===0){ console.log('Something unexpected happened. The displayed result might be wrong.') return } if(elements.length>1) console.log('Something unexpected happened, but it probably does not affect the result.') csrf_token=elements[0].content } $.post('/data/standings',{ participantId:participantId, problemId:problemId, csrf_token:csrf_token },function(result){ cache[problemId]=result result.forEach(function(x){ cacheSubmissions[x.submissionId]=x }) callback(result) } ) } } if(location.href.match('://codeforces.com/contest/\\d*/my')){ let restoreFunctions=[] function restoreAll(){ observer.disconnect() for(let t of restoreFunctions){ t() } restoreFunctions=[] } let button function clickResetButton(){ restoreAll() if(searchParams.has('reset_button')){ document.body.removeChild(button) button=undefined } } function createResetButton(){ if(button===undefined){ if(searchParams.has('reset_button')){ button=document.createElement('button') button.innerHTML='Reset' button.onclick=clickResetButton document.body.appendChild(button) } } } let observer=new MutationObserver(function(mutations, observer){ for (let r of mutations){ let t=r.target // must be in local scope if(t.tagName==='SPAN'){ if(t.classList.contains('contest-state-phase')){ if(t.textContent==='Finished'&&!searchParams.has('always_show')){ if(restoreFunctions.length!==0){ // unlikely clickResetButton() } observer.disconnect() return } }else if(t.classList.contains('verdict-accepted')){ if(t.textContent==='Accepted'){ restoreFunctions.push(function(){ t.textContent='Accepted' }) createResetButton() t.textContent='Pretest passed' } }else if(t.classList.contains('verdict-rejected')&&t.textContent.includes('on test')){ // for some reason it's not possible to use unsafeWindow.getProblemId now let verdictWrapper=t.parentNode let tableRow=verdictWrapper.parentNode.parentNode let problemId=tableRow.children[3].getAttribute('data-problemId') // int-parseable string let submissionId=parseInt(tableRow.children[0].textContent) if(participantId===undefined) participantId=parseInt(tableRow.children[2].getAttribute('data-participantId')) // temporarily set accepted, otherwise for slow network the user may briefly see WA for main test failed { let oldTextContent=t.textContent // must be in local scope t.classList.replace('verdict-rejected','verdict-accepted') t.textContent='Pretest passed' restoreFunctions.push(function(){ t.classList.replace('verdict-accepted','verdict-rejected') t.textContent=oldTextContent }) createResetButton() getData(problemId,function(result /*unused */){ if(!cacheSubmissions[submissionId].verdict.includes('main tests')){ t.classList.replace('verdict-accepted','verdict-rejected') t.textContent=t.oldTextContent.replace('on test','on pretest') } }) } } } } }) observer.observe(document,{ childList:true, subtree:true, attributes:false }); window.addEventListener('load',function(){ }) } })() // TODO incomplete (rewrite standings table) //if(location.href.match('://codeforces.com/contest/\\d*/standings')){ // let observer=new MutationObserver(function(mutations, observer){ // /* // let logout_link=document.querySelector('[href$="logout"]') // if(logout_link!==null) // let handle=logout_link.previousElementSibling.textContent) // */ // // GM_addStyle(String.raw // .highlighted-row td[problemid] { // visibility: hidden; // } // ) // observer.disconnect() // }) // observer.observe(document,{ // childList:true, // subtree:true, // attributes:true // }); //} // vim: set ts=4 sw=4 fdm=indent: Please report any bug that you can find.
•  » » 11 months ago, # ^ | ← Rev. 2 →   0 Fixed userscript+ explanation why the old one is wrong: https://codeforces.com/blog/entry/70305