For TopCoder SRMs I always use TopCoderParser, an IntelliJ IDEA plugin from Yakov Sirotkin. It is a great simple tool that pastes a problem description as .java solution template with sample tests. To make plugin work with latest versions of my favorite IDE (like IntelliJ IDEA 9 Community Edition), I fixed the line #128 of the original source code.
Instead of:
PsiElementFactory factory = element.getManager().getElementFactory();
use:
PsiFileFactory factory = PsiFileFactory.getInstance(element.getProject());
Thanks to the original authors. Simply copy topcoderparser.jar to the IDEA plugins directory, and RETester.java (simple test invoker from Roman Elizarov) to your project directory. Enjoy.
How about other languages? Can it generate the .cpp solution template with sample tests? And does it support quick generation of some headers, that the coder usually prefers to use? For example, something like this:
#define For(i,a,b) for(int i=(int)(a);i<=(int)(b);++i)
I use Kawigi plugin right now, but I am not quite satisfied with it. For example, it generates sample tests incorrectly in case of "floating" result, that is, it compares the expected answer with actual one without any precision, and often outputs errors, while the solution passes the system tests.
Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(28,14),absolute(57,60),button=1,modifiers=Button1,clickCount=1] on ###overrideRedirect###: com.intellij.psi.impl.source.PsiClassImpl cannot be cast to com.intellij.psi.PsiDirectory
java.lang.ClassCastException: com.intellij.psi.impl.source.PsiClassImpl cannot be cast to com.intellij.psi.PsiDirectory
at ru.telamon.topcoderparser.TopCoderParserAction1.run(TopCoderParserAction.java: 127)
atcom.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java: 754)
atru.telamon.topcoderparser.TopCoderParserAction.actionPerformed(TopCoderParserAction.java: 124)
atcom.intellij.openapi.actionSystem.impl.ActionMenuItemActionTransmitter.actionPerformed(ActionMenuItem.java:218)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:81)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:496)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access300(BegMenuItemUI.java: 43)
atcom.intellij.ui.plaf.beg.BegMenuItemUIMyMouseInputHandler.mouseReleased(BegMenuItemUI.java:516)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:627)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:504)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:405)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:369)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)